Jon Rosebaugh wrote:

> What are we supposed to do with Unicode? As far as I can tell, the
> Unicode type passes its defined length directly to the underlying
> string, so that a Unicode(30) column is turned into a VARCHAR(30) or
> the dialect equivalent. I may be able to determine that a particular
> column should hold up to 30 Unicode characters, for example, but if
> the default encoding of UTF-8 is used, each character will use
> anywhere from one to four byes, so that in the extreme case, it will
> be trying to stuff a 120-byte string into a VARCHAR(30)! The only way
> to be certain of the length is to use UTF-32, although in practice I
> doubt I will ever get astral plane characters in this app, so UTF-16
> would probably be sufficient. But I _like_ UTF-8 and would prefer to
> use it. Perhaps the Unicode type should multiply its length by 4?

What RDBMS you use?  And what is the encoding of the specific database where
you tested this?  If you have a database with UTF-8 encoding then it will
be expecting 30 Unicode characters coded with the UTF-8 encoding, no matter
how many bytes it takes to store then.

A VARCHAR(30) is not referring to 30 bytes, but to 30 characters.

If you are mixing encodings then sooner or later you'll have big problems.


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

Reply via email to