Jorge Godoy schrieb:
> 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.
Unless he is using Oracle with NLS_LENGTH_SEMANTICS as Bytes..., then its
really Bytes..., but thats a bad setting for various reasons.

Michael

-- 
Michael Schlenker
Software Engineer

CONTACT Software GmbH           Tel.:   +49 (421) 20153-80
Wiener Straße 1-3               Fax:    +49 (421) 20153-41
28359 Bremen
http://www.contact.de/          E-Mail: [EMAIL PROTECTED]

Sitz der Gesellschaft: Bremen | Geschäftsführer: Karl Heinz Zachries
Eingetragen im Handelsregister des Amtsgerichts Bremen unter HRB 13215


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