Help with unicode and sqlobject/pysqlite2

Q

qvx

I really can't seem to make sqlobject/pysqlite2 save my local Easter
European characters.

I am a Windows-1250 user and I have sys.setdefaultencoding('dbcs') in
my sitecustomize.

How can I save data like "šdccž"?
This is equivalent to '\x9a\xf0\xe8\xe6\x9e'

I'm using the latest version of sqlobject from SVN.

qvx
 
?

=?windows-1252?Q?Gerhard_H=E4ring?=

qvx said:
I really can't seem to make sqlobject/pysqlite2 save my local Easter
European characters.

I am a Windows-1250 user and I have sys.setdefaultencoding('dbcs') in
my sitecustomize.

How can I save data like "šdccž"?
This is equivalent to '\x9a\xf0\xe8\xe6\x9e'

I'm using the latest version of sqlobject from SVN.

I can't speak for SQLObject (yet), but if you want to insert text data
using pysqlite, you have to either encode them to UTF-8 or use unicode
strings.

You can convert to unicode strings using
unicode('\x9a\xf0\xe8\xe6\x9e', 'dbcs'). As your system default encoding
is 'dbcs', even unicode('\x9a\xf0\xe8\xe6\x9e') would be enough.

HTH,

-- Gerhard
 

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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top