views:

500

answers:

1

I have this textbox on an .aspx page, which when submitted it stores whatever typed in the textbox into a nvarchar column in MS SQL 2005.

It works fine, until you try putting chinese characters.
These characters are converted to question marks (?) in the database.

How do you store non-english characters from a <input type="text"> to database?

+4  A: 

The main thing would be to ensure that every step of the pipeline supports international characters; i.e. - at what point do you first see "?" ? In the aspx code? Or only once it gets into the database table?

The web page should already be using an encoding such as UTF8, so that should be OK - but what data type are you using at the database? It would need to be nchar/nvarchar(n)/nvarchar(max) (or ntext on older versions of SQL Server).

Marc Gravell
Hi thanks. When I pasted a chinese character in the textbox it looks fine. But in the database (and when you read back from the database to an aspx page) they become ????. And I forgot to mention it's nvarchar(50), I edited the question thanks.
So when does it first become ??? - have you looked at fiddler? debugged the ASP.NET app?
Marc Gravell