Help with unicode and sqlobject/pysqlite2

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • qvx

    #1

    Help with unicode and sqlobject/pysqlite2

    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.setdefaulte ncoding('dbcs') in
    my sitecustomize.

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

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

    qvx

  • Gerhard Häring

    #2
    Re: Help with unicode and sqlobject/pysqlite2

    qvx wrote:[color=blue]
    > 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.setdefaulte ncoding('dbcs') in
    > my sitecustomize.
    >
    > How can I save data like "šdccž"?
    > This is equivalent to '\x9a\xf0\xe8\x e6\x9e'
    >
    > I'm using the latest version of sqlobject from SVN.[/color]

    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\x f0\xe8\xe6\x9e' , 'dbcs'). As your system default encoding
    is 'dbcs', even unicode('\x9a\x f0\xe8\xe6\x9e' ) would be enough.

    HTH,

    -- Gerhard

    Comment

    Working...