On Feb 8, 2008, at 3:22 AM, borg42 wrote:

> I'm new to Symfony and I need to know how it addresses the UTF-8 vs
> VARCHAR(n) problem that appears all in out projects: eg. if I have a
> VARCHAR(4) field, I need to have an INPUT field of max. 4 characters
> that permits 'aaaa' (4 bytes) but not 'aaáá' (6 bytes). My first guess
> was using the size check in YAML file, but permits entering a 6-byte
> string into a 4-byte field (as it seems to measure in characters, not
> bytes), resulting in a fat PropelException when the DB insert/update
> fails. I want the user to have a nice feedback from the system that  
> he/
> she has exceeded the maximum length.
>
> Could you desribe how the Symfony framework addresses this issue? (I'm
> using 1.0.x.)

Not that it addresses your issue directly, but from:

http://dev.mysql.com/doc/refman/5.0/en/char.html

The CHAR and VARCHAR types are declared with a length that indicates  
the maximum number of characters you want to store. For example,  
CHAR(30) can hold up to 30 characters.

Assuming here you're using MySQL, the column type length specification  
indicated the number of *characters*, not bytes. You seem to be mixing  
the terms "bytes" and "characters" interchangeably above. Looking  
further down the page, you can reference the chat showing a 4  
character string stored in a varchar(4) column actually ends up using  
5 bytes of storage.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony 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/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to