Every time I think I understand string encoding I get reminded that I
don't.

I have a simple form where I can cut and paste in a value with an
"interesting" character in it (e.g. "Foo(r)" - in case that doesn't come
thru that's "F" "o" "o" followed by a registered trademark symbol).
It gets stored in the database just fine and can then be viewed.  If I
try to manipulate this value directly I get a truncation error.

Here's an example with a fancy right quote char:

>>> p.number = '53 5/8\x94H x 21\x94D x 47 1/4\x94L'
>>> p.save()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "c:\Python24\Lib\site-packages\django\db\models\base.py", line
218, in save
    db_values + [pk_val])
  File "c:\Python24\Lib\site-packages\django\db\backends\util.py",
line 12, in execute
    return self.cursor.execute(sql, params)
  File "C:\Python24\Lib\site-packages\MySQLdb\cursors.py", line 165,
in execute
    self._warning_check()
  File "C:\Python24\Lib\site-packages\MySQLdb\cursors.py", line 80, in
_warning_check
    warn(w[-1], self.Warning, 3)
  File "C:\Python24\lib\warnings.py", line 61, in warn
    warn_explicit(message, category, filename, lineno, module,
registry)
  File "C:\Python24\lib\warnings.py", line 96, in warn_explicit
    raise message
_mysql_exceptions.Warning: Data truncated for column 'number' at row 1

I can cut an paste the actual string into the web form and it's
totally happy.  I've started to poke around the code to see if I can
determine what's going wrong, but I was hoping a helpful soul out
there could point my in the right direction.

thanks.


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to