On Wed, Jun 4, 2008 at 5:23 AM, AndyB <[EMAIL PROTECTED]> wrote:

>
> I'm struggling to understand the following:
> http://dpaste.com/54745/
>
> It's a legacy database that's had the data imported with a variety of
> tools - not all of them very well behaved when it comes to character
> encoding. The offending character is a UK pound sign (163 in unicode
> and latin1 I believe)
>
> I initially thought that the field contained latin1 and therefore
> wasn't happy being saved when Django was expecting Unicode but when I
> construct a unicode string it compares as true to the character that
> is causing the problem but gives an error when I save.
>
> I then tried:
> p.land_value_comments = unichr(163)
> p.save()
>
> and got the same error.
>
> Then I tried creating a new record with just that single character in
> it and that didn't work either.
>
> Can anyone help me understand what's going on here? My dev server is
> running MySQL 4.1.21 Could that be part of the problem?
>

Your traceback shows:

C:\Python24\lib\site-packages\MySQLdb\cursors.py in execute(self, query, args)
    146         #query = query.encode(charset)
    147         if args is not None:
--> 148             query = query % db.literal(args)
    149         try:
    150             r = self._query(query)

Why is line 146 commented out?  The code here looks like it basically
matches up with the 1.2.1_p2 version of MySQLdb, but in the released code
line 146 is not commented out (see
http://mysql-python.svn.sourceforge.net/viewvc/mysql-python/tags/MySQLdb-1.2.1_p2/MySQLdb/MySQLdb/cursors.py?revision=448&view=markup).


Did you make that change in debugging this problem?  If so you need to undo
it and anything else in MySQLdb and Django code that you changed so that
people here can help debug with known quantities.  If you didn't make that
change, you probably need to re-install MySQLdb because the version you are
running doesn't appear to match any officially released one.

Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to