Re: What effects MySQL connection's character set

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

 



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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux