Re: Translation2 and UTF-8
| From: | Tim Denby | Date: | Sat, 11 Nov 2006 23:40:06 +0000 |
| Subject: | Re: Translation2 and UTF-8 | ||
| References: | 1 2 | Groups: | php.pear.general php.pear.general |
| Request: | Send a blank email to pear-general+get-25777@lists.php.net to get a copy of this message | ||
Thank you for responding, Lorenzo. I think that I followed your steps correctly:
- I used the pear command line to upgrade MDB2 to version 2.3.0, which I then confirmed with "pear list"
- I replaced the version 1.2.2 (dated August) of file /usr/share/php/Translation2/Container/mdb2.php with version 1.2.4 (dated October) from cvs.php.net
But when I call
echo $tr->get('month_01', 'calendar', 'zh_CN');
from my code I still get question marks in the place of the Chinese characters.
If I write code querying the db directly with mysql_query() and a SET NAMES utf8 instruction, or going through the MDB2 layer with a SET NAMES, or if I use an XML container with Translation2, the Chinese displays correctly.
For the "encoding" value in the langs_avail table I've tried both "UTF-8" and "utf8".
Any ideas?
I should note that I'm not using the Admin package to add the language data, I'm using a SQL query, but for each table I'm setting ENGINE MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci
Thanks,
Tim
Lorenzo Alberton wrote:
it should work with the MDB2 container (CVS version) and with MDB2 2.3.0. You can now call $tr2->addLang() with a new parameter, where you can set the charset and collation: ================================================ $newLang = array('lang_id' => 'en', 'table_name' => 'i18n', 'name' => 'english', 'meta' => 'some meta info', 'error_text' => 'not available', 'encoding' => 'iso-8859-1',); $options = array('charset' => 'latin1', 'collation' => 'latin1_bin',); $tr2->addLang($newLang, $options); ================================================ I'd love to receive some feedback, if you could provide some, it would be great. TIA.