473,320 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

UTF-8 Coding of MSSQL 2005 DB

Hi List,

I am searching franticly for a solution (or the procedure) to setting
the coding of a new DB to UTF-8. I can find no setting in the Server
Manager, during creation of the DB, to influence this. Can someone
please show me the way? Thanks

--Shawn
Mar 26 '08 #1
3 9352
See the following artciles:

Description of storing UTF-8 data in SQL Server (the article points to SQL
7/2000, but 2005 still uses UCS-2)
http://support.microsoft.com/kb/232580

UTF8 String User-Defined Data Type
http://msdn2.microsoft.com/en-us/library/ms160893.aspx

International Features in Microsoft SQL Server 2005
http://msdn2.microsoft.com/en-us/library/bb330962.aspx

HTH,

Plamen Ratchev
http://www.SQLStudio.com

Mar 26 '08 #2
Hi Plamen,

Thanks for your answer.
See the following artciles:

Description of storing UTF-8 data in SQL Server (the article points to
SQL 7/2000, but 2005 still uses UCS-2)
http://support.microsoft.com/kb/232580
I found this one, but could not really understand the meat of the mater.
UTF8 String User-Defined Data Type
http://msdn2.microsoft.com/en-us/library/ms160893.aspx

International Features in Microsoft SQL Server 2005
http://msdn2.microsoft.com/en-us/library/bb330962.aspxB
Basically, there is no native UTF-8 storage then in MSSQL, am I 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?

I am speaking of storing German charachters like "äöüß"

--shawn
Mar 26 '08 #3
On Mar 26, 11:11 am, Shawn Beasley <shawn.beas...@freenet.dewrote:
Hi List,

I am searching franticly for a solution (or the procedure) to setting
the coding of a new DB to UTF-8. I can find no setting in the Server
Manager, during creation of the DB, to influence this. Can someone
please show me the way? Thanks

--Shawn

I have converted my data from Latin 1 to UTF-8 in MSSQL.

The first thing to realise is (as has already been mentioned), MSSQL
uses UCS-2, a 2 byte Unicode encoding scheme. Not UTF-8, but we can
still use it.

What I did was create another table with an ntext column type (instead
of the old text used for Latin 1, of course your column in question
may be varchar etc, so you will need to create a table with a column
of type nvarchar etc).

What I then did is create a script to pull the data out of the old
table and insert it into the new table with the ntext column.
For each line I pulled out I used a function to encode it into UTF-8
(I was using php, maybe you could use
Convert::Scalar::utf8_encode() ? ). For that line I executed an SQL
statement to insert the line into the new table, however I prefixed
the Letter 'N' to the value of the newly UTF-8 encoded string. This
tells the db to treat the string as a unicode constant and not to
apply any of its own formatting/encoding to the string.

Now the newly encoded values in your new table may look like garbage
through the MSSQL gui, but the data is correctly encoded in UTF-8 and
will display in a webpage with UTF-8 content-type headers.

Maybe there is an easier way to do it, but this worked for me.

Hope that helps at least a little.
Raymond
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: lawrence | last post by:
Someone on www.php.net suggested using a seems_utf8() method to test text for UTF-8 character encoding but didn't specify how to write such a method. Can anyone suggest a test that might work?...
4
by: Alban Hertroys | last post by:
Another python/psycopg question, for which the solution is probably quite simple; I just don't know where to look. I have a query that inserts data originating from an utf-8 encoded XML file....
38
by: Haines Brown | last post by:
I'm having trouble finding the character entity for the French abbreviation for "number" (capital N followed by a small supercript o, period). My references are not listing it. Where would I...
6
by: jmgonet | last post by:
Hello everybody, I'm having troubles loading a Xml string encoded in UTF-8. If I try this code: ------------------------------ XmlDocument doc=new XmlDocument(); String s="<?xml...
6
by: archana | last post by:
Hi all, can someone tell me difference between unicode and utf 8 or utf 18 and which one is supporting more character set. whic i should use to support character ucs-2. I want to use ucs-2...
7
by: Jimmy Shaw | last post by:
Hi everybody, Is there any SIMPLE way to convert from UTF-16 to UTF-32? I may be mixed up, but is it possible that all UTF-16 "code points" that are 16 bits long appear just the same in UTF-32,...
4
by: shreshth.luthra | last post by:
Hi All, I am having a GUI which accepts a Unicode string and searches a given set of xml files for that string. Now, i have 2 XML files both of them saved in UTF-8 format, having characters...
10
by: Jed | last post by:
I have a form that needs to handle international characters withing the UTF-8 character set. I have tried all the recommended strategies for getting utf-8 characters from form input to email...
23
by: Allan Ebdrup | last post by:
I hava an ajax web application where i hvae problems with UTF-8 encoding oc chineese chars. My Ajax webapplication runs in a HTML page that is UTF-8 Encoded. I copy and paste some chineese chars...
4
by: =?ISO-8859-2?Q?Boris_Du=B9ek?= | last post by:
Hi, I have an API that returns UTF-8 encoded strings. I have a utf8 codevt facet available to do the conversion from UTF-8 to wchar_t encoding defined by the platform. I have no trouble...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.