Unix Technical Forum

Problems character sets / special characters dot.Net <-> mssql-server

This is a discussion on Problems character sets / special characters dot.Net <-> mssql-server within the SQL Server forums, part of the Microsoft SQL Server category; --> Hi, I come from the "dark side" php/mysql and there often problems with character sets (utf-8, latin...) and storing ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-01-2008, 03:48 PM
Klaus Herzberg
 
Posts: n/a
Default Problems character sets / special characters dot.Net <-> mssql-server

Hi,
I come from the "dark side" php/mysql and there often problems with
character sets (utf-8, latin...) and storing data in datebase.

Exists in the world of dot.net and ms-sql-server similiar problems?

To precise: I have to store xml-data in database. Maybe its better to
encode (like base64) the strings?

Perhaps there are some links to read?

Thanks.

klaus.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-01-2008, 03:48 PM
Plamen Ratchev
 
Posts: n/a
Default Re: Problems character sets / special characters dot.Net <-> mssql-server

You do not need to do any encoding. If you are using SQL Server 2000 then
you can use the NVARCHAR data type (which supports Unicode characters
http://en.wikipedia.org/wiki/Unicode) to store the XML.

SQL Server 2005 added native support for XML data type, which will makes it
the natural choice for storing XML:
http://msdn2.microsoft.com/en-us/library/ms345117.aspx
http://www.code-magazine.com/Article...uickid=0605081

HTH,

Plamen Ratchev
http://www.SQLStudio.com

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-01-2008, 03:48 PM
Erland Sommarskog
 
Posts: n/a
Default Re: Problems character sets / special characters dot.Net <-> mssql-server

Klaus Herzberg (klausherzberg@gmail.com) writes:
> I come from the "dark side" php/mysql and there often problems with
> character sets (utf-8, latin...) and storing data in datebase.
>
> Exists in the world of dot.net and ms-sql-server similiar problems?


Character conversion is always a problem, if you don't do it right. :-)

> To precise: I have to store xml-data in database. Maybe its better to
> encode (like base64) the strings?


No, that is a not a good idea. SQL Server supports Unicode, and there is
also a native xml type (in SQL 2005). What you should be aware of that
SQL Server does not support UTF-8, but always store Unicode data in
UTF-16.

For character data you should use nchar/nvarchar which is Unicode
and not char/varchar which is the local 8-bit set.

--
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-01-2008, 03:48 PM
Klaus Herzberg
 
Posts: n/a
Default Re: Problems character sets / special characters dot.Net <-> mssql-server

thank you for help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:30 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com