Re: UTF-8 encoding in AJAX web application.
- From: stcheng@xxxxxxxxxxxxxxxxxxxx (Steven Cheng[MSFT])
- Date: Tue, 20 Mar 2007 03:20:22 GMT
Hello Allan,
Thanks for your reply.
Of course, for .net application, using the ADO.NET SqlCommand and
SqlParameter objects to supply any dynamic parameters should be the
preferred approach. For your SQL Server 2000 database table's column(that
will store the posted chinese characters), is it defined as unicode
character type(such as nchar, nvarchar or ntext ...)? If the column
datatype is of unicode, it should be able to store the chinese characters
correctly, otherwise, you need to make sure the table/column or database's
collation is correctly set as Chinese collation so that chinese chars can
be stored in non-unicode encoded format.
In addition, for SQL Server (7.0 or 2000) unicode datatype, it is stored in
UCS-2 charset (no matter the data is originally encoded in UTF-8, UTF-16
or....). Here is a good MSDN reference introducing the international
features in SQL Server 2000
http://msdn2.microsoft.com/en-us/library/aa902644(SQL.80).aspx
For your current code that directly use inline SQL command text to execute
the insert query, I think you can try adding a 'N' prefix in each string
parameter, this prefix is used to explicit mark the parameter value as
unicode chars.
#Why do some SQL strings have an 'N' prefix?
http://databases.aspfaq.com/general/why-do-some-sql-strings-have-an-n-prefix
html
If you have any further specific questions, please feel free to let me know.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
.
- Follow-Ups:
- Re: UTF-8 encoding in AJAX web application.
- From: Allan Ebdrup
- Re: UTF-8 encoding in AJAX web application.
- From: Allan Ebdrup
- Re: UTF-8 encoding in AJAX web application.
- References:
- UTF-8 encoding in AJAX web application.
- From: Allan Ebdrup
- Re: UTF-8 encoding in AJAX web application.
- From: Jon Skeet [C# MVP]
- Re: UTF-8 encoding in AJAX web application.
- From: Steven Cheng[MSFT]
- Re: UTF-8 encoding in AJAX web application.
- From: Allan Ebdrup
- UTF-8 encoding in AJAX web application.
- Prev by Date: Re: drawimage
- Next by Date: Re: poss to use strings to index?
- Previous by thread: Re: UTF-8 encoding in AJAX web application.
- Next by thread: Re: UTF-8 encoding in AJAX web application.
- Index(es):
Relevant Pages
|