Hello!
I can't figure out how to use database with non-english symbols in a path.
The story: I want to keep application database in "application data" folder
under MSW. I got this folder using particular wxPython function that returns
unicode string. If I glue together that path and my database filename, then
connect() function failed due the "unicode decode error". So I understand
pysqlite accepts only 8-bit strings. Looking into sqlite source code I was
under impression that utf-8 encoded strings should be ok. But it doesn't
work with pysqlite. connect() still failed until I manually encode path
using cp1251 coding (that is used in russian windows).
"Hardwiring" particular encoding is a bad thing for shure, so I invent a
simple workaround:
back = getcwd()
chdir( path-with-unicode-symbols )
connect( just-filename )
chdir( back )
... but it looks really ugly. Is there a better way to archive this?
Vladimir Ignatov
|