Chinese and other special characters.

Started by nolefan, April 22, 2007, 11:29:58 AM

Previous topic - Next topic

Sarge

Let's see...

When using UTF-8, SMF issues "SET NAMES utf8" before dealing with database data; that SQL command overrides latin1 or any other charset in the MySQL configuration and database setup.

When SMF is not using UTF-8, it uses the MySQL default charsets. In your case, it seems that MySQL is using UTF-8, but the database data are in latin1.

You can force SMF to use latin1 explicitly. One way to do this is to add $db_character_set in Settings.php (in your main forum directory). Make a backup copy of Settings.php before modifying it!

1. Download Settings.php from your forum directory to your computer.
2. Open it in a text editor.
3. Search for $db_character_set in the file.
4.
    a) if there's no line that starts with $db_character_set, find this (at the end of the file):

?>

    and before that line, add this:

$db_character_set = 'latin1';

    b) if $db_character_set is already set (to 'utf8', maybe?), set it to 'latin1' as above.
5. Save the file and upload it to your forum directory. Make sure that it replaces the original Settings.php.

Again: make a copy of Settings.php before modifying it!

    Please do not PM me with support requests unless I invite you to.

http://www.zeriyt.com/   ~   http://www.galeriashqiptare.net/


Quote
<H> I had zero posts when I started posting

smurfyforum

THAT WORKED!!! THANK YOU SOOOOOOOOOOOOOOOOOOOOOOO MUCH!! This has been making me nuts for a month now!! LOL!!!


"Smurfs, Smurfs, and More Smurfs!"

Sarge

Glad it helped! :)

A word of advice: Next time, please start new topics for your own issues. Topics marked as solved are not checked by the Support Team. (I noticed your reply only because I had set notifications for this topic.) Also, asking for support about your own issues in other people's topics is generally not recommended.

Thank you! :)

    Please do not PM me with support requests unless I invite you to.

http://www.zeriyt.com/   ~   http://www.galeriashqiptare.net/


Quote
<H> I had zero posts when I started posting

albanian

I wont to convert Albanian Character  how do i ?  If AN Albanian Can help me in albanian is more simple for me,,,, My email [email protected]

Sarge

Quote from: albanian on January 30, 2009, 07:38:40 PM
I wont to convert Albanian Character  how do i ?  If AN Albanian Can help me in albanian is more simple for me,,,, My email [email protected]

Hello Erion, we have an Albanian language board here. ;)

    Please do not PM me with support requests unless I invite you to.

http://www.zeriyt.com/   ~   http://www.galeriashqiptare.net/


Quote
<H> I had zero posts when I started posting

albanian


cold77

Thank you Sarge is worked for me!

Quote from: Sarge on July 06, 2007, 01:20:34 AM
Quote from: nolefan on June 29, 2007, 01:02:57 AM
Quote from: Sarge on June 28, 2007, 07:43:21 AM
Have you converted your forum with Admin > Forum Maintenance > "Convert the database and data to UTF-8"?

I don't have anything in the forums maintenance that says " Convert Database and data to UTF-8".

Have you tried deleting the entry global_character_set = UTF-8 in smf_settings and going to Admin > Forum Maintenance again? If you do that, the link I mentioned should appear.

Open phpMyAdmin (if you can access it for your hosted account), select your forum database and click on the SQL icon. It looks like this:



Enter the query (copy/paste from below) into the box and click the Go button.

DELETE FROM `smf_settings` WHERE `variable` = 'global_character_set' LIMIT 1;

The query above works if your forum tables prefix is smf_ (which is the default). You can find the exact prefix for your forum in Admin > Server Settings > Database Tables Prefix -- if it is different from smf_ then you have to modify the query before running it in phpMyAdmin.


[edit]
Also check the variables mentioned in this post:
http://www.simplemachines.org/community/index.php?topic=165442.msg1056581#msg1056581

Smoking Mountains

#47
I'm having the same problem of not able to display chinese characters. I used the "Fantastico De Luxe" to install the SMF as well. I've tried Sarge's suggestion by running this code below

DELETE FROM `smf_settings` WHERE `variable` = 'global_character_set' LIMIT 1;

and then "Convert HTML-entities to UTF-8 characters" in "Forum Maintenance".

But i'm not as lucky.  :-[

Attached is the server variables and settings. Any suggestion? Thank you!

Smoking Mountains

i guess this shows the problem? should i change all the "latin1_swedish_ci" to "utf8_general_ci"? if so, how do i do that?

thanks.

Norv

Please post a link to your forum.
Also, if you have in Admin > maintenance the option to "Convert the database and forum to utf8", perhaps you can try that, but only after making a complete backup of the database. (preferably using phpMyAdmin's "Export" feature for backup).
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

Sarge

Quote from: Smoking Mountains on August 21, 2009, 05:49:03 AM
I've tried Sarge's suggestion by running this code below

DELETE FROM `smf_settings` WHERE `variable` = 'global_character_set' LIMIT 1;

and then "Convert HTML-entities to UTF-8 characters" in "Forum Maintenance".

1) Are you sure it wasn't "Convert the database and data to UTF-8"? The other option ("Convert HTML-entities to UTF-8 characters") should appear only after the conversion, not before.

2) Also, if you have a copy of Settings.php from before the conversion, see if there is a line for $db_character_set (see reply #40 in this topic for more details.)


Quote from: Smoking Mountains on August 21, 2009, 05:49:03 AM
But i'm not as lucky.  :-[

3) What encoding does your browser use when visiting your forum? In Firefox it can be seen at View menu > Character Encoding, and in Internet Explorer at View > Encoding.


Quote from: Smoking Mountains on August 21, 2009, 06:03:32 AM
i guess this shows the problem? should i change all the "latin1_swedish_ci" to "utf8_general_ci"? if so, how do i do that?

Yes, that probably means that the conversion didn't happen. Please see my three questions above (don't modify anything for the moment.)

Oh, and absolutely get a full backup of the database before making any more changes, as Norv said.

    Please do not PM me with support requests unless I invite you to.

http://www.zeriyt.com/   ~   http://www.galeriashqiptare.net/


Quote
<H> I had zero posts when I started posting

Smoking Mountains

Thank you Norv. My site was just created, so it is pretty much empty. But here is a link to the post that is supposed to be in Chinese. hxxp:forums.lanbud.com/index.php?topic=5.msg6#new [nonactive]

Smoking Mountains

Quote from: Sarge on August 21, 2009, 06:18:46 AM
1) Are you sure it wasn't "Convert the database and data to UTF-8"? The other option ("Convert HTML-entities to UTF-8 characters") should appear only after the conversion, not before.

Oh, and absolutely get a full backup of the database before making any more changes, as Norv said.

Thanks Sarge. Please see attached image. I'm backing up the forum now.

Sarge

I see that your forum is brand new, so you don't really have anything to backup. At worst, you could simply delete and/or reinstall it :)

Please see my second question:
Quote from: Sarge on August 21, 2009, 06:18:46 AM
2) Also, if you have a copy of Settings.php from before the conversion, see if there is a line for $db_character_set (see reply #40 in this topic for more details.)

    Please do not PM me with support requests unless I invite you to.

http://www.zeriyt.com/   ~   http://www.galeriashqiptare.net/


Quote
<H> I had zero posts when I started posting

Smoking Mountains

Quote from: Sarge on August 21, 2009, 06:18:46 AM
2) Also, if you have a copy of Settings.php from before the conversion, see if there is a line for $db_character_set (see reply #40 in this topic for more details.)

i just checked this. that line was already
$db_character_set = 'utf8';

and i changed it to
$db_character_set = 'latin1';

but it didn't make a difference.

Smoking Mountains

aha, it is working now!!!!

after i changed the "utf8" to "latin1" per your suggestion, and went to "Forum Maintenance", there was the option to convert the database, after i did that, i did "Convert HTML-entities to UTF-8 characters" as well.

wow. problem fixed!

thank you so much!!!

i was chatting with the web host tech support guy and he told me "we can't help you."

Sarge

Quote from: Smoking Mountains on August 21, 2009, 06:50:02 AM
after i changed the "utf8" to "latin1" per your suggestion, and went to "Forum Maintenance", there was the option to convert the database, after i did that, i did "Convert HTML-entities to UTF-8 characters" as well.

Be sure to change that line back to "utf8", if this wasn't done automatically by the conversion. Anyway, I'm glad to know it's fixed now. :)

Also, due to the way support is done here, please be sure to start your own topics for your own support questions. Thank you! :)

    Please do not PM me with support requests unless I invite you to.

http://www.zeriyt.com/   ~   http://www.galeriashqiptare.net/


Quote
<H> I had zero posts when I started posting

allanmiller99

Thanks! Its working for me also.

Great help!

retireincebu.com

Advertisement: