Afficher un message
Vieux 26/03/2008, 18h03   #5
Erland Sommarskog
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: UTF-8 Coding of MSSQL 2005 DB

Shawn Beasley (shawn.beasley@freenet.de) writes:
> Basically, there is no native UTF-8 storage then in MSSQL, am I right?


Right.

> I mean, the scripts that we are using in perl are writing to the DB in
> UTF8, and the displayed information in the webapp is returning properly,
> but when you look at the data in the table, it is displayed
> incorrectly. Does that seem right?


The best handling would be to store data in the nvarchar data type as
UCS-2. You would Unicode both in the web application and in the database,
just encoded differently.

I don't know what API you use from Perl, but if you use Win32::SqlServer,
it will handle all necessary conversion from UTF-8 to UCS-2 and back for
you completely seamlessly. I don't know about DBD/DBI, but it may be more
difficult with these, as they are designed to be portable between platforms,
whereas Win32::SqlServer is designer for SQL Server only.

You find Win32::SqlServer on my web site,
http://www.sommarskog.se/mssqlperl/index.html.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
  Réponse avec citation
 
Page generated in 0,05840 seconds with 9 queries