python, mssql and unicode

Diez B. Roggisch deets at nospam.web.de
Thu Nov 3 17:29:11 EST 2005


riek at zem.uni-bonn.de wrote:
> 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



More information about the Python-list mailing list