Contact Yart for a relaxed conversation
Your Name * Message *
Your Email *  
Your Phone   
Our Phone:        03 8685 8718 (within Australia)
61 3 8685 8718 (outside Australia)
Contact Yart

The E-Commerce, software integration and business automation specialists

 

– call us on 03 8685 8718

Resources / ASP NET / Saving Chinese Unicode in ASP NET
Saving Chinese and Unicode Characters in ASP.NET

There are a lot of articles about this on the net:

http://csharpindepth.com/Articles/General/Strings.aspx
http://www.joelonsoftware.com/articles/Unicode.html

But suffice to say this. When you save characters from a form postback the characters ***will*** be encoded. If you do not specify an encoding it will be determined for you.

This can be very confusing!!!

Chinese characters may appear to look OK in ASP but not in ASP.NET

So to stop problems, always declare your encodings! Typically we use utf-8.

In ASP, do this:

@CodePage = 65001
Option Explicit

Session.CodePage = 65001
Response.CodePage = 65001
Response.CharSet = "utf-8"


When saving SQL directly, make sure the characters get saved in nvarchar, ntext etc

Declare the encoding in HTML as well:

meta http-equiv="Content-Type" content="text/html; charset=UTF-8"


In ASP.NET, add this to web.config:

globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
fileEncoding="utf-8"

The latest at Yart
Search: