On 2006-11-14 22:23, Robin Haswell wrote:
> Create a table with a column defined as varchar(4), with one of the
> Unicode collations.
>
> Insert 'öööö' into the column, then select it out again.
>
> You'll find your select result only contains 'öö'. This is because
> MySQL varchar(4) means 4 *bytes*, not characters (and ö is two
> bytes). It's not multibyte character aware.

Hm, I can not confirm that. I did some tests, and MySQL always delivered 
the complete data e.g. 'öööö'

I tested it on two machines, and got two slightly different results 
(double byte vs. single byte representation?) after reading from 
database:

1st machine:
>>> p.test
u'\xc3\xb6\xc3\xb6\xc3\xb6\xc3\xb6'
>>> print p.test
öööö

2nd machine:
>>> p.test
u'\xf6\xf6\xf6\xf6'
>>> print p.test
öööö

Any explanation for that difference?

> This can cause lots of exceptions in Python when multibyte characters
> are truncated at the size limit of a column. When Python sees half a
> multibyte character, an exception is raised.

Maybe dependent from the MySQL version?

But anyway, good to know, that such behavior may happen.

Ciao,
Stefan

-- 
Start here: www.meretz.de

--~--~---------~--~----~------------~-------~--~----~
 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to