Ok, so I am lost. The debugger is not too much help at this point. I assume
this setup should work so we can go from there.
-----CUT---------
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os, sys, glob MySQLdb
from sqlobject import *
sqlhub.processConnection = connectionForURI('mysql://test:[EMAIL PROTECTED]
/test?charset=utf8&use_unicode=1
class Temp(SQLObject):
class sqlmeta:
table = "temp"
fromDatabase = True
def add(label):
return Temp(label=label)
add = staticmethod(add)
a = 'Chèrie'
t = Temp.add(a)
print 'Done'
This fails, can you give me any advise on where to look or how to debug?
Thanks
Glenn
On Jan 7, 2008 11:59 AM, Oleg Broytmann <[EMAIL PROTECTED]> wrote:
> On Mon, Jan 07, 2008 at 11:43:24AM -0500, Glenn MacGregor wrote:
> > It looks like somewhere in SQLObject we are calling decode on the
> variable
> > which contains Ch?rie to decode it to ascii. Is this the intended
> result?
>
> No, "decoding" in Python means converting from str to unicode. Somewhere
> (in UnicodeStringValidator in col.py) the string is decoded from str using
> utf-8 charset, but the decoding fails.
>
> > I have tried to manually define the column in the class definition,
> >
> > label = UnicodeCol()
> >
> > This did not change anything
>
> Of course. Setting "use_unicode" in DB URI changes every StringCol to
> UnicodeCol.
> You can declare it StringCol explicitly, and then use only str, not
> unicode.
>
> > I have tracked it down to the return statement of the
> StringLikeConverter,
> > line 96 on converters.py. return "'%s'" % value seems to be doing a
> decode
> > (or encode) which is failing.
>
> I doubt it. At the time the converter works unicode should be converted
> to str already.
>
> > Note in the debugger I see the type of the
> > param value in that function is str, I would think it would be unicode.
>
> UnicodeStringValidator.from_python() has converted it to str.
>
> Oleg.
> --
> Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED]
> Programmers don't die, they just GOSUB without RETURN.
>
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss