Jump to content

PHP MySQL unicode and chinese characters


jamina1

Recommended Posts

Hello!

We have a weird problem with PHP, MySQL, Phpmyadmin and some chinese characters.

 

The page in question has a "contact" form - which emails to our sales department. We *finally* got chinese characters coming through the email by converting the page to utf8. However, now that we're storing the data in our database we've come across a problem.

 

When I do show variables like 'c%';

I get the following:

+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | latin1                     |
| character_set_connection | latin1                     |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | latin1                     |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
| collation_connection     | latin1_swedish_ci          |
| collation_database       | utf8_general_ci            |
| collation_server         | utf8_general_ci            |

 

With this setup, we put some chinese characters through PHP. They go in, and when we query through PHP they look fine.

But in phpmyadmin they look like this: 测仪è”系(美国). Not cool.

 

So I tried to convert all the other things to utf8 by using the SET NAMES 'utf8';

Here's what it looks like after the SET NAMES:

 

+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
| collation_connection     | utf8_general_ci            |
| collation_database       | utf8_general_ci            |
| collation_server         | utf8_general_ci            |

 

But it STILL looks like 测仪è”系(美国) in phpmyadmin.

We need 本网站发送的所有电子邮件都有记录以用于商店管理 to look like chinese, not 测仪è”系(美国).

 

How can we accomplish this?

Link to comment
Share on other sites

That's strange.... I just tried inserting that and then looking in PHPMyAdmin and it works fine x.x.

 

character_set_client utf8

character_set_connection utf8

character_set_database latin1

character_set_filesystem binary

character_set_results utf8

character_set_server latin1

character_set_system utf8

character_sets_dir C:\Program Files\MySQL6\share\charsets\

collation_connection utf8_general_ci

collation_database latin1_swedish_ci

collation_server latin1_swedish_ci

 

The table is utf8_unicode_ci.

 

 

PHPMyAdmin 3.0.

 

 

There isn't a multilingual version of PHPMyAdmin is there?  Maybe yours is defaulting to displaying everything in ASCII or something.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.