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.
# -*- coding: utf-8 -*-
import os, sys, glob MySQLdb
from sqlobject import *
sqlhub.processConnection = connectionForURI('mysql://test:test@localhost/test?charset=utf8&use_unicode=1
table = "temp"
fromDatabase = True
add = staticmethod(add)
a = 'Chèrie'
t = Temp.add(a)
On Mon, Jan 07, 2008 at 11:43:24AM -0500, Glenn MacGregor wrote:> which contains Ch?rie to decode it to ascii. Is this the intended result?
> It looks like somewhere in SQLObject we are calling decode on the variable
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.Of course. Setting "use_unicode" in DB URI changes every StringCol to
> I have tried to manually define the column in the class definition,
> label = UnicodeCol()
> This did not change anything
You can declare it StringCol explicitly, and then use only str, not
unicode.I doubt it. At the time the converter works unicode should be converted
> 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.
to str already.UnicodeStringValidator.from_python() has converted it to str.
> Note in the debugger I see the type of the
> param value in that function is str, I would think it would be unicode.