python, mssql and unicode

R

riek

Hello,

I am using pymssql (http://pymssql.sourceforge.net/) to insert data
from a web-frontend (encoded in utf-8) into fields of type nvarchar of
an MS-SQL Server 2000.

The problem is, ms-sql server uses ucs-2 and not utf-8. I have looked
around a bit but found no suitable solution to this problem so far
except converting the utf-8 into latin-1 which will restrict the
characters to western europe languages.

Does any one have some suggestions?

Thank you for your help!

Simon
 
D

Diez B. Roggisch

Hello,

I am using pymssql (http://pymssql.sourceforge.net/) to insert data
from a web-frontend (encoded in utf-8) into fields of type nvarchar of
an MS-SQL Server 2000.

The problem is, ms-sql server uses ucs-2 and not utf-8. I have looked
around a bit but found no suitable solution to this problem so far
except converting the utf-8 into latin-1 which will restrict the
characters to western europe languages.

Does any one have some suggestions?

Thank you for your help!

Hey Simnon,

cool dich hier zu lesen :)

AFAIK you should be able to use utf-16 as encoding for most practical
pusrposes.

http://www.python.org/peps/pep-0100.html

Alternatively, it might be possible to have the mysql connection deliver
and expect the string values in a different encoding from the one the
data is stored in - at least with oracle that's possible.

Regards,

Diez B. Roggisch
 
R

riek

Hi Diez :)

I tried converting the query string to utf-16 but only got weird
results. The problem might lie with the _mssql module (which pymssql is
using, it's just a wrap around _mssql) that I am using...

I'll post what I get from converting to utf-16 later, maybe you have an
idea...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top