Re: [PHP-DB] What effects MySQL connection's character set
what i read.. i conclusion. whenever the data is.. is always latin1 right?? if the data seem give strange type (example like japanese font).. it will stay on latin1 or change into apropriate data On 2/1/07, Niel Archer [EMAIL PROTECTED] wrote: Hi all Finally identified the problem. Was pretty obvious in retrospect. The mysqli class (Improved MySQL extension OO style) defaults to latin1 as a character set, regardless of what PHP is using. Simple solution is to use the set_charset method (mysqli_set_charset for non OO) on the object, which will change the connection parameter. Niel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- akan ada dimana mulut terkunci dan suara tak ada lagi.. saat itu gunakanlah HP untuk melakukan SMS!! - ini aliran bedul.. bukan aliran aneh. tertawa sebelum tertawa didepan RSJ.. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] What effects MySQL connection's character set
Hi all Finally identified the problem. Was pretty obvious in retrospect. The mysqli class (Improved MySQL extension OO style) defaults to latin1 as a character set, regardless of what PHP is using. Simple solution is to use the set_charset method (mysqli_set_charset for non OO) on the object, which will change the connection parameter. Niel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] What effects MySQL connection's character set
Hi Thanks for this. That page didn't actually help, but one of the follow ups did. Apparently, despite being setup as UTF-8 throughout the Db, tables, and columns. The returned data still can default to Latin1. I've forced my test server to return UTF-8 (I hope) and am trying it out today. Fingers crossed! That turned out to be overly optimistic. Even Though the server is using UTF-8 throughout, it still defaults to latin1 on connections. So I used the SET NAMES utf8. It still will not work as I expect. I used the following code to test it. $Db = new mysqli($Host, $User, $Pass, $Db); $Db-query(SET NAMES utf8); $result = $Db-query(SHOW VARIABLES LIKE 'character\_set\_%'); $count = $result-num_rows; while ($count): $dummy = $result-fetch_assoc(); print $dummy['Variable_name'] . = . $dummy['Value'] . \n; --$count; endwhile; print \ncharacter_set_name: . $Db-character_set_name() . \n; Which results in the following output: character_set_client = utf8 character_set_connection = utf8 character_set_database = utf8 character_set_results = utf8 character_set_server = utf8 character_set_system = utf8 character_set_name: latin1 I can't find any documentation on PHP's character encoding, beyond the default_charset directive. Several of the functions/extensions have documentation, but not PHP itself. I suspect the problem is with php itself or the mysqli extension, which was my original thought and reason for my post. Anyone have any ideas? Niel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] What effects MySQL connection's character set
Niel Archer wrote: Hi all How is the character set of returned data effected? I have a DB using UTF-8 encoding., PHP is set to use UTF-8 internally. However the MySQL connection returns Latin1 data. How can I get it to return UTF-8 data instead. http://dev.mysql.com/doc/refman/4.1/en/charset-literal.html Should cover your questions :) -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] What effects MySQL connection's character set
Hi all How is the character set of returned data effected? I have a DB using UTF-8 encoding., PHP is set to use UTF-8 internally. However the MySQL connection returns Latin1 data. How can I get it to return UTF-8 data instead. TIA Niel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] What effects MySQL connection's character set
try to configure on the html.. i think on header.. meta http-equiv=Content-Type content=text/html; charset=utf-8 / - Original Message - From: Niel Archer [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Saturday, January 27, 2007 3:12 AM Subject: [PHP-DB] What effects MySQL connection's character set Hi all How is the character set of returned data effected? I have a DB using UTF-8 encoding., PHP is set to use UTF-8 internally. However the MySQL connection returns Latin1 data. How can I get it to return UTF-8 data instead. TIA Niel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php