Smart Trimming of UTF-8 Entities for Database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I need to be able to store UTF-8 characters from a form into a MySQL table. But I need to support pre-UTF-8 MySQL (< 4.1).

So I'm converting UTF-8 characters into their numeric entities (e.g. ñ = &#241;).

The problem is that if the user enters a character that gets converted to an entity, the string might end up being longer than the field definition in the table allows.

For example, if I have a varchar(5) column and try to insert "señor" (which has been converted to "sen&#241;or"), I get "sen&#" in the table which is useless.

Has anyone dealt with this and if so how?

Thanks in advance for any advice, or pointers to any code that deals with this.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux