On 3-Oct-06, at 7:36 PM, Malcolm Tredinnick wrote:

> So this is the value that the string has right at the moment the
> exception occurs? Can you paste the traceback you see, please (and
> preferably the value of 'sql' and 'params' at that point as well).
>
> I'm a bit in the dark about what is happening right now, since
> subsituting a UTF-8 string into a Python string should work easily.
>
>>>> s = unicode('Djang\xc3\xa9', 'utf-8')
>>>> print "update foo set blah = '%s'" % s
>         update foo set blah = 'Djangé'
>
> is an example of what should be happening. I suspect there is  
> something
> else important about what you are doing. Not accusing you of
> deliberately misleading or anything -- I have no idea what the  
> important
> thing is yet, either.

Actually, this is what I get:

 >>> import sys
 >>> print sys.version
2.4.3 (#1, Mar 30 2006, 11:02:16)
[GCC 4.0.1 (Apple Computer, Inc. build 5250)]

 >>> s = unicode('Djang\xc3\xa9', 'utf-8')
 >>> print "update foo set blah = '%s'" % s
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in  
position 28: ordinal not in range(128)

But, if I do this:

 >>> s = 'Djang\xc3\xa9'
 >>> print "update foo set blah = '%s'" % s
update foo set blah = 'Djangé'

I haven't played with the default encoding at all.

Thanks,
Beau
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to