Simplified Chinese characters display as question marks
Permalink 1 user found helpful
I am trying to do a very simple website. Content needs to be in both English and Simplified Chinese.
Whenever I try to enter Chinese characters in the blocks, the output is a series of question marks.
Is this one of the software's limitations, or is it something I'm dong wrong?
Many thanks in advance to anyone who can help me.
David
Whenever I try to enter Chinese characters in the blocks, the output is a series of question marks.
Is this one of the software's limitations, or is it something I'm dong wrong?
Many thanks in advance to anyone who can help me.
David
I have the same problem, and I really want to add Chinese to my site. Could sb. help, please?
Use utf8_unicode_ci and it should work fine.
Change your database encoding.
Run the following SQL replacing DATABASE with your database name:
Change your database encoding.
Run the following SQL replacing DATABASE with your database name:
ALTER DATABASE DATABASE DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci
And how and where can I change the database encoding please?Thank you.
Either from the command line:
$ mysql
> use DATABASE;
> ALTER DATABASE DATABASE DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci
or from PHPMyAdmin (usually through cPanel) or locally:
1. Select the Database (from the left)
2. Click on Operations tab (top right)
3. Goto Collation (at the bottom)
4. Select 'utf8_unicode_ci' and click Go
$ mysql
> use DATABASE;
> ALTER DATABASE DATABASE DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci
or from PHPMyAdmin (usually through cPanel) or locally:
1. Select the Database (from the left)
2. Click on Operations tab (top right)
3. Goto Collation (at the bottom)
4. Select 'utf8_unicode_ci' and click Go
Thanks! I was having the same problem, but fixed it in cPanel as you said... I have no idea how to write code, so thanks for the details.
Tip for others: you have to click on phpMyAdmin in cPanel to get to the place where you can change your databases as referenced by okhayat. Actually, once you are logged into phpMyAdmin, I think you can change the collation for all of your databases at once on the main page--but somebody correct me if I'm wrong about that.
Tip for others: you have to click on phpMyAdmin in cPanel to get to the place where you can change your databases as referenced by okhayat. Actually, once you are logged into phpMyAdmin, I think you can change the collation for all of your databases at once on the main page--but somebody correct me if I'm wrong about that.
okhayat, thank you very much for the instruction. it's very helpful.
I am building a Chinese website. I corrected the collation to 'utf8_unicode_ci' according to your instructions in PhpMyAdmin. However, it does not remove the problem. Chinese characters are sitll showed as question marks.
How to do? Thanks in advance.
How to do? Thanks in advance.
I too need some help. I have followed the steps but still get question marks...
Could this be a problem with my concrete5 theme?
:(
Could this be a problem with my concrete5 theme?
:(
I'm doing a site just now that has multiple languages and was having problems getting the chinese characters to be accepted by my database. I changed the collation to utf_general_ci in phpmyadmin but the problem was it didin't change individual fields so didn't work.
I then found this script which i placed as a php file in the root of my website and ran it.
http://stackoverflow.com/questions/105572/a-script-to-change-all-ta...
Please make sure you backup your database before trying it and if it goes wrong then you can restore. If you don't backup you might lose everything!!!
The script worked perfectly for me though.
I then found this script which i placed as a php file in the root of my website and ran it.
http://stackoverflow.com/questions/105572/a-script-to-change-all-ta...
Please make sure you backup your database before trying it and if it goes wrong then you can restore. If you don't backup you might lose everything!!!
The script worked perfectly for me though.
Thanks! This appears to have worked on my website! You are the best.
where is that? In my cPanel I have few choices. The one on the left it says MySQL databases. When I clicked on it I have Create DB, Modify Db but no operations of collation.
Please help
Please help
Do you have access to phpmyadmin?
If not install the package sqlbuddy from Remo as I'm pretty sure it gives you the option to change the collation.
Also make sure you have a backup of the datrabase before you do anything.
Cheers
Al
If not install the package sqlbuddy from Remo as I'm pretty sure it gives you the option to change the collation.
Also make sure you have a backup of the datrabase before you do anything.
Cheers
Al
I went to the PhpAdmin and it has a drop down box which allows you to change to any collation. So i switch to utf8_unicode_ci . I went back to my page and I can write Greek but not Chinese!
yeah you need to switch the collation on every table within the database. That's why I used the script mentioned above as it does it automatically.
C5 has a lot of tables to do it manually :)
C5 has a lot of tables to do it manually :)
Is this the code?
How should I name my file?
and from below code what do I change? db1 to my DBname? Anything else? Sorry but I am not a php programmer :-)
How should I name my file?
and from below code what do I change? db1 to my DBname? Anything else? Sorry but I am not a php programmer :-)
<?php // your connection mysql_connect("localhost","root","***"); mysql_select_db("db1"); // convert code $res = mysql_query("SHOW TABLES"); while ($row = mysql_fetch_array($res)) { foreach ($row as $key => $table) { mysql_query("ALTER TABLE " . $table . " CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci"); echo $key . " => " . $table . " CONVERTED<br />"; } } ?>
no, the code is as follows
Place this in a file called dbupdate.php on your web server. Change the variables username, password and database at the start of the script to what your database expects, i.e. what you used when you installed C5.
browse to the script in your browser, i.e.http://www.yousite.com/dbupdate.php...
<?php function MysqlError() { if (mysql_errno()) { echo "<b>Mysql Error: " . mysql_error() . "</b>\n"; } } $username = "root"; $password = ""; $db = "database"; $host = "localhost"; $target_charset = "utf8"; $target_collate = "utf8_general_ci"; echo "<pre>";
Viewing 15 lines of 127 lines. View entire code block.
Place this in a file called dbupdate.php on your web server. Change the variables username, password and database at the start of the script to what your database expects, i.e. what you used when you installed C5.
browse to the script in your browser, i.e.http://www.yousite.com/dbupdate.php...
I did it but when i check it in my browser I get the error:
Mysql Error: Access denied for user 'oushuie1'@'localhost' (using password: NO)
in dbupdate.php I change the following to:
Mysql Error: Access denied for user 'oushuie1'@'localhost' (using password: NO)
in dbupdate.php I change the following to:
$username = "admin"; $password = "MyAdminPasswd1234"; $db = "oushuie1_cnc1"; $host = "localhost";
Where do i paste this on my web server? public_html?
any help would be appreciated.
I'm having problems showing chinese simplified characters.
any help would be appreciated.
I'm having problems showing chinese simplified characters.
yeah just place it in public_html and the go towww.www.yoursite.com/scriptname.php...
obvioulsy yoursite.com changes to your url and scriptname changes to what you have called the script in public_html
I would get rid of the script once you have ran it and it's all working.
obvioulsy yoursite.com changes to your url and scriptname changes to what you have called the script in public_html
I would get rid of the script once you have ran it and it's all working.
I've recently face the issue again, but not with text coming from the DB. The theme PHP files had BOM character saved with the text. When I removed it using:
tail --bytes=+4 file.php
it fixed the issue for some sites, but not the others.
Hope this might help someone who gets stuck with the same issue.
tail --bytes=+4 file.php
it fixed the issue for some sites, but not the others.
Hope this might help someone who gets stuck with the same issue.
Could anyone give me some help?