Re: Translation2 and UTF-8
| From: | Lorenzo Alberton | Date: | Sun, 12 Nov 2006 13:30:49 +0000 |
| Subject: | Re: Translation2 and UTF-8 | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25783@lists.php.net to get a copy of this message | ||
Hi Tim,
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"you also have to upgrade the db driver: $ pear upgrade MDB2_Driver_mysql[i]
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.
Any ideas?
yes, probably the current MDB2_Driver_mysql::setCharset()
implementation isn't enough (it only sets the client
charset, not the server and connection charset).
Can you try replacing the body of the aforementioned method
(in file /pear/MDB2/Driver/mysql[i].php) with these lines?
==================================================
function setCharset($charset, $connection = null)
{
$query = "SET NAMES $charset";
return $this->_doQuery($query, true, $connection);
}
==================================================
It should probably solve the issue you mentioned.
If you can confirm it, I'll include the fix in the
next MDB2 release.
TIA
--
Lorenzo Alberton
http://pear.php.net/user/quipo
___________________________________________________________________
Quipo Free Internet - 2 email, 150 Mb di spazio web e molto di più.
ADSL, Hardware & Software Online Store