Did you tried
b.name = u'Accord\xe9on'
foo = s.Fields("MarqueLib").Value
print type(foot)
print type(u'Accord\xe9on' )
On 24 mar, 16:12, "mettwoch" <[EMAIL PROTECTED]> wrote:
> I try to eliminate a legacy MS-Access DB. My choice is TG + MySQL. But
> I'm blocked at an early state because of an encoding error when trying
> to move data from MS-Access to MySQL via SQLObject. I use a DAO
> connection to the Jet engine and here is what happens on the first
> field that contains an "é" (I am in Luxembourg and here it's very
> usual that we use foreign languages like French, German or English)
>
> Here is what happens in the "tg-admin shell":
>
> >>> b.name
>
> u'Accord\xe9on'
>
> b is an instance of a Brand class with the UnicodeCol "name". The
> value shown here is what I entered using MySQL Query Browser. The
> value reads "Accordéon"
>
> >>> rs.Fields("MarqueLib").Value
>
> u'Accord\xe9on'
>
> This comes from the legacy MS-Access DB and obviously it seems that
> the DAO object works with Unicode values. The value shown here is the
> same that's in the Brand.name
>
> Now, by doing this silly thing in the "tg-admin shell" here I get a
> strange error that I cannot figure out where it comes from:
>
> >>> b.name = rs.Fields("MarqueLib").Value
>
> Traceback (most recent call last):
> File "<console>", line 1, in ?
> File "<string>", line 1, in <lambda>
> File "c:\python24\lib\site-packages\SQLObject-0.7.3-py2.4.egg
> \sqlobject\main.p
> y", line 1062, in _SO_setValue
> self._connection._SO_update(
> File "c:\python24\lib\site-packages\SQLObject-0.7.3-py2.4.egg
> \sqlobject\dbconn
> ection.py", line 567, in _SO_update
> self.query("UPDATE %s SET %s WHERE %s = (%s)" %
> File "c:\python24\lib\site-packages\SQLObject-0.7.3-py2.4.egg
> \sqlobject\dbconn
> ection.py", line 753, in query
> return self._dbConnection._query(self._connection, s)
> File "c:\python24\lib\site-packages\SQLObject-0.7.3-py2.4.egg
> \sqlobject\dbconn
> ection.py", line 304, in _query
> self._executeRetry(conn, conn.cursor(), s)
> File "c:\python24\lib\site-packages\SQLObject-0.7.3-py2.4.egg
> \sqlobject\mysql\
> mysqlconnection.py", line 77, in _executeRetry
> myquery = unicode(query, self.encoding)
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
> 32: ordinal
> not in range(128)
>
> Why seems to happen a ASCII decoding here? I've everything in utf8.
>
> Some more parameters:
> - The MySQL DB is in UTF-8
> - The URI to connect to the DB contains the key charset=utf8
> - My systems default CP is CP850 (but I think this should'nt matter as
> I'm not trying to display any value here)
>
> Please help because I really want this to work
>
> Thx
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---