Hello Bernhard,

I have not a real solution for you but a howto (in german) about
unicode with Python:
http://wiki.python.de/Von_Umlauten%2C_Unicode_und_Encodings

After reading this I had the big AHA about unicode and
encodings.

Maybe it helps.

kindly regards

Lutz Steinborn
4c AG


On Wed, 21 Feb 2007 13:20:31 +0100
[EMAIL PROTECTED] wrote:

> 
> 
> Hello all
> 
> I've tried to correct our string handling by using sqlobject's UnicodeCol
> and stumbled a bit.
> 
> The following script produces errors when assigning the string or the
> unicode column:
> 
> # -- test.py
> # -!- encoding: iso8859-1 -!-
> import sqlobject
> dbURI = 'mysql://user1:[EMAIL PROTECTED]/db1'
> sqlobject.sqlhub.processConnection = sqlobject.connectionForURI(dbURI)
> 
> class A(sqlobject.SQLObject):
>     aString         = sqlobject.StringCol(default = None)
>     aUnicodeString  = sqlobject.UnicodeCol(default = None)
> 
> try: A.createTable()
> except: pass
> 
> a = A()
> a.aString           = 'gaääää'
> a.aUnicodeString    = u'ga\u00ef\u00ef\u00ef'
> # -- test.py
> 
> (The string I'm trying to assing contains german umlauts, just in case it
> won't display correctly...)
> 
> I would expect that at least the second assignment should be valid. But, as
> the first assignment's value is also a valid python string, shouldn't this
> be valid, too?
> 
> Do I need to change the sqlobject.sqlhub.processConnection's encoding
> property?
> 
> How is this done correctly?
> 
> Thanks a lot!
> Bernhard
> 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to