Re: utf-8 characters not show up properly in the result of mysql> select command line
Date: Fri, 05 Dec 2014 18:54:17 +0100
Message-ID: <5481f149$0$2912$e4fe514c_at_news.xs4all.nl>
What happens if you test following code: <?php
echo "tést"; echo "<br>"; echo strlen("tést"); echo "<br>"; echo "test"; echo "<br>"; echo strlen("test"); echo "<br>";
?>
Does it produce this as output (it should!):
tést
5
test
4
to output of this php code (from commandline):
$ php utftest.php | hexdump -C
00000000 74 c3 a9 73 74 3c 62 72 3e 35 3c 62 72 3e 74 65
|t..st<br>5<br>te|
00000010 73 74 3c 62 72 3e 34 3c 62 72 3e |st<br>4<br>|0000001b
notice the 'é' uses two bytes because it's utf8
Finally, this seems like a PHP problem, and not a mysql problem?
On 5-12-2014 16:54, bill_j_chen_at_yahoo.com wrote:
> I have a webserver which we can input the book title, book description etc. The data is saved into a mysql database and table columns has collation "utf8_general_ci".
>
> In book infomration show up in the webpage (using character set utf8) correctly when I use the webpage to search the books.
>
> But I have some issue when query the database using mysql client (command line). The any entry with chinese (utf8) shows up scrambled.
>
> I made sure that my fedora 20 can handle and display utf8 chinese correctly in command line. and mysql > show VARIABLES like 'char%'; returns:
>
> character_set_client utf8
> character_set_connection utf8
> character_set_result utf8
> character_set_system utf8
>
> Actually I run the mysql select command in the same machine hosting the webserver and mysql databas, which is fedora 20. In the fedora shell, I can vi, cat any utf8 file without problem.
>
> I don't know what elese I missed.
>
> Another question - do we have way to get the value of the booktitle byte by byte? then at least I can see what value stored inside table, that might give me some idea.
>
> Thanks.
>
Received on Fri Dec 05 2014 - 18:54:17 CET