View Full Version : How can I use UTF-8 to save data ?

10-26-2003, 11:24 AM
Dear all.

I want to B able to show more than one language on my web-site,

my server uses codepage: 1252
my SQL Server collation is: SQL_Latin1_General_CP1_CI_AS

So now I'm using utf-8 on my ASP pages and it does show ALL unicode languages,

I descover ntext type on SQL Server and started using it to store the language texts,

and I defined my ASP page to run as code page 1252
@ CODEPAGE="1252"

and set the meta tag to Unicode (utf-8):
META http-equiv="Content-Type" content="text/html; charset=utf-8"
META http-equiv="Content-Language" content="en-us"

The problem:
if I try to save data (POST) it does not keep the original characters,

only if I use charset 1252 (as on my server) it show correctly on the Unicode pages

META http-equiv="Content-Type" content="text/html; charset=windows-1252"
META http-equiv="Content-Language" content="en-us"

so when I save data using the Unicode (utf-8) pages - it does not show well

10-27-2003, 04:54 AM
Hi me :-)

I found the problem,

by using @ CODEPAGE="1252" I did not get the effect I wanted,

as suggested by MSDN:

I should also use Session.CodePage=1252

it is now working and my ASP pages (that also uses the utf-8 meta tag) can show Unicode

one thing I could not figure out is when should I use codepage 65001
anyway, my ASP files are saved as UTF-8 files with notepad and I did try
to set both codepage and @codepage on the server to 65001 but it did not work,
it only worked with codepage 1252 as used on my server and in the DB collation...

so if U R using codepage 65001 and it is working please let me know what am I missing.