Advertisement:

Author Topic: How to show Chinese Characters in an English Forum  (Read 32843 times)

Offline stageducky

  • Jr. Member
  • **
  • Posts: 124
    • singaporetheatre.com
How to show Chinese Characters in an English Forum
« on: November 03, 2008, 10:36:52 AM »
I would like to know how to show chinese characters in  an English Forum. I have already read some post and have tried changing server setting to English UTF-8 and also tried English British UTF-8 but it still show a "peace face and question marks" Any idea what's wrong? 

Can someone send me to any link that may answer this question. Or anyway that can provide step by step ways on how to change setting to make it work?

Thanks, appreciates

Offline Compuart

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,774
  • Gender: Male
  • Zéeeeal
    • RealityNet
Re: How to show Chinese Characters in an English Forum
« Reply #1 on: November 03, 2008, 02:44:58 PM »
Basically, Chinese characters can be shown in any forum, regardsless of the character set. If the character set the forum is in does not contain Chinese characters, the browser will automatically send HTML entities. HTML entities look like { and should support the full Unicode range. Note that it is advised to use UTF-8 in case you want to show multiple languages.

There are about two likely reasons why you wouldn't see the characters properly: you're mixing character sets (e.g. the forum is in a different character set than the language files, the forum used to use a different character set than it's currently using, etc.) or your browser/computer/font has no support for Chinese characters.
Hendrik Jan Visser
Former Lead Developer & Co-founder www.simplemachines.org
Personal Signature:
Realitynet.nl -> ExpeditieRobinson.net / PekingExpress.org / WieIsDeMol.Com

Offline stageducky

  • Jr. Member
  • **
  • Posts: 124
    • singaporetheatre.com
Re: How to show Chinese Characters in an English Forum
« Reply #2 on: November 11, 2008, 08:12:41 AM »
Hi Compuart,

1) I used English for the Forum because of some of the mod that I have installed.
2) My Computer reads Chinese Character without any problems in other websites and chinese website even.
3) I have Chinese font installed in my computer system too.

I have tried changing the forum language setting to utf-8 but the Chinese Character still didn't show. In place was the smiley face and "?"

I have tried changing phpmyadmin but there is no utf-8 selection. Any further possibility?

Offline Sarge

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 6,209
  • Gender: Male
    • Zëri YT!
Re: How to show Chinese Characters in an English Forum
« Reply #3 on: November 13, 2008, 03:08:05 PM »
stageducky, you're not supposed to change table collations from phpMyAdmin, as you mentioned in your other topic, because the data will still be in latin1.

SMF can do the conversion automatically. By any chance, did you install SMF via Fantastico? Read Chinese and other special characters. for more information.
    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

Offline stageducky

  • Jr. Member
  • **
  • Posts: 124
    • singaporetheatre.com
Re: How to show Chinese Characters in an English Forum
« Reply #4 on: November 13, 2008, 03:29:28 PM »
Hi Sarge,

Yes I did indeed installed through Fantastico. Thanks for info. I tried changing the collation. but reverted it back when nothing happened after the change. I will read the link you posted. Thanks

Offline Sarge

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 6,209
  • Gender: Male
    • Zëri YT!
Re: How to show Chinese Characters in an English Forum
« Reply #5 on: November 13, 2008, 03:38:06 PM »
It's a Fantastico bug that causes the issue. The topic I linked to contains the fix. ;) Basically, you simply need to delete global_character_set from the smf_settings table and you should be able to see the UTF-8 conversion link in the SMF admin control panel. Carry out the conversion and you should be set.

Remember to get a full database backup before attempting anything. Conversion from UTF-8 is usually not reversible, especially when the data contains non-latin1 characters (Chinese etc).

Let us know how it goes! :)
« Last Edit: November 13, 2008, 03:41:01 PM by Sarge »
    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

Offline stageducky

  • Jr. Member
  • **
  • Posts: 124
    • singaporetheatre.com
Re: How to show Chinese Characters in an English Forum
« Reply #6 on: November 15, 2008, 11:25:18 AM »
Hi Sarge,

Thanks for your help. My forum can show Chinese Text without any issue now. It was really a simple procedure. Just follow the instruction on going into phpmyadmin -> select the _smf forum database -> click on SQL tab -> Copy and past the lines that you have given into the query box and hit go... there wasn't any need even to run convert from HTML to UTF8.

Thanks very very much. Really appreciate your help.
« Last Edit: November 15, 2008, 11:45:35 AM by stageducky »

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,327
  • Master of BBC Abuse
Re: How to show Chinese Characters in an English Forum
« Reply #7 on: November 17, 2008, 07:46:16 PM »
Ok, I have a similar dilemma, but I want the ability to use Arabic in posts.

Note that I don't require themes or mods themselves to support Arabic. In fact I'd prefer that they didn't (to make administration easier).

All I want is the ability to display Arabic in posts and nowhere else, preferably without it being necessary to change any settings when using both Arabic and English in the same post. 

Is this what a standard UTF-8 conversion will give me?

To put it another way, what is the minimum required to get the result I want?

Offline agridoc

  • SMF Hero
  • ******
  • Posts: 3,274
  • Gender: Male
    • Aeromodelling GR - Aeromodelling in Greece
Re: How to show Chinese Characters in an English Forum
« Reply #8 on: November 17, 2008, 08:09:46 PM »
antechinus you can use UTF-8, otherwise you can "cheat" by changing the codepage in index.english.php to windows-1256 or ISO-8859-6.

In Multilingual in SMF 1.1RC2 without UTF for Greek and other languages? you can find more on this solution.
  For Greek aeromodellers and our friends around the world  - Greek Button sets for SMF - Greeklish to Greek mod
Δeν αφιερώνω χρόνο για μηνύματα σε greeklish.

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,327
  • Master of BBC Abuse
Re: How to show Chinese Characters in an English Forum
« Reply #9 on: November 17, 2008, 08:14:46 PM »
Awesome. Thanks for the tip. Cheating sounds like fun. :D

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,327
  • Master of BBC Abuse
Re: How to show Chinese Characters in an English Forum
« Reply #10 on: November 17, 2008, 08:22:13 PM »
Ok, I read the link but am rather puzzled. This bit:

It's an old topic but I should write what happens.

SMF RC1 and RC2 don' t need a patch to work this way in a Unix or Linux server.

implies that 1.1.7 should display other languages without using this hack.
What am I missing?

Offline agridoc

  • SMF Hero
  • ******
  • Posts: 3,274
  • Gender: Male
    • Aeromodelling GR - Aeromodelling in Greece
Re: How to show Chinese Characters in an English Forum
« Reply #11 on: November 22, 2008, 03:56:29 PM »
There is no need for patching 1.1.7

I downloaded chinese languages for SMF and I found

In index.chinese-simplified.php
Code: [Select]
$txt['lang_character_set'] = 'gbk';
In index.chinese-traditional.php
Code: [Select]
$txt['lang_character_set'] = 'big5';
In SMF 1.1.7 installation
In index.english.php
Code: [Select]
$txt['lang_character_set'] = ISO-8859-1;
By changing here ISO-8859-1 to gbk or bg-5, depending on chinese selection, one may have SMF with english menu showing correctly chinese stored with SMF using chinese language. I can' t test, I believe it should work.

You can test in my site http://www.aeromodelling.gr/ForumS/index.php?language=english&topic=44.msg2540#msg2540 , I had added forced English. You can test as a guest without subscription. Same approach, for Greek and windows-1253.

It's a good solution for an old working forum or for ISO-8859-1 and another character set language, no need for database conversion. However, for true multilingual and many languages, UTF-8 is the proper solution.
  For Greek aeromodellers and our friends around the world  - Greek Button sets for SMF - Greeklish to Greek mod
Δeν αφιερώνω χρόνο για μηνύματα σε greeklish.

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,327
  • Master of BBC Abuse
Re: How to show Chinese Characters in an English Forum
« Reply #12 on: November 22, 2008, 05:05:24 PM »
Agridoc, you're a genius.  ;D  I just tested it on my local host and it appears to work perfectly.
Arabic text is displayed nicely. All BBC tags work on it (ie: bold, size, etc).
The forum still runs in English just like it should and  there don't seem to be any error messages being generated.
Thank you very much. I owe you one.

Offline agridoc

  • SMF Hero
  • ******
  • Posts: 3,274
  • Gender: Male
    • Aeromodelling GR - Aeromodelling in Greece
Re: How to show Chinese Characters in an English Forum
« Reply #13 on: November 22, 2008, 05:16:17 PM »
Ooops! I forgot you were interested about arabic. Proper codepage windows-1256 or ISO-8859-6.

It's nothing but a simple trick.
  For Greek aeromodellers and our friends around the world  - Greek Button sets for SMF - Greeklish to Greek mod
Δeν αφιερώνω χρόνο για μηνύματα σε greeklish.

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,327
  • Master of BBC Abuse
Re: How to show Chinese Characters in an English Forum
« Reply #14 on: November 22, 2008, 05:31:50 PM »
Yup.The odd thing is that I tried windows-1256 on my local host and it works perfectly, but it wont work online with my public server. I'll test ISO-8859-6 now and see if that works.

ETA: Nope, that doesn't work either. It's good on my local but no good online.
« Last Edit: November 22, 2008, 05:36:24 PM by antechinus »

Offline agridoc

  • SMF Hero
  • ******
  • Posts: 3,274
  • Gender: Male
    • Aeromodelling GR - Aeromodelling in Greece
Re: How to show Chinese Characters in an English Forum
« Reply #15 on: November 22, 2008, 06:21:10 PM »
Strange. A link of the working forum might help.
  For Greek aeromodellers and our friends around the world  - Greek Button sets for SMF - Greeklish to Greek mod
Δeν αφιερώνω χρόνο για μηνύματα σε greeklish.

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,327
  • Master of BBC Abuse
Re: How to show Chinese Characters in an English Forum
« Reply #16 on: November 22, 2008, 06:52:04 PM »
Hey that's weird. I just tried it on a test site and it works!
Check this out.  :D

Maybe the file edit via ftp didn't take properly on the main site. I'll try it again and see what happens. Also we were testing it in a private board so it is possible ( ? ) that the permssions had something to do with it. Maybe? Possibly? Gremlins? Aliens?

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,327
  • Master of BBC Abuse
Re: How to show Chinese Characters in an English Forum
« Reply #17 on: November 22, 2008, 07:12:24 PM »
Ok, here's the main site where it doesn't work.
It's on the same server but runs in the public_html directory instead of in a sub-directory.
The post content is exactly the same but Arabic text wont display.

This is a funny one. :P

Identical quoted test post here.

ETA: Just thought of something. The only real difference between the two forums is mods installed.
Both have Tiny Portal 0.983 but the main site (where this trick doesn't work) also runs other mods


ETA2: One of the members who is rather nifty at computer stuff said this:

Quote
Hey, I think it might be because of the "Content-Type" header sent by the server which overrides the content-type specified in the HTML document:

E.g.: Content-Type: text/html; charset=UTF-8

I tested this on another test site that runs exactly the same mods as the main site but runs in a sub-directory off public_html (IOW, on a mirror forum in a different folder).

Result: it works there. This means the problem is caused by the main site running directly from public_html. If it was in a sub-directory there would be no problem.
« Last Edit: November 23, 2008, 12:35:33 AM by antechinus »

Offline agridoc

  • SMF Hero
  • ******
  • Posts: 3,274
  • Gender: Male
    • Aeromodelling GR - Aeromodelling in Greece
Re: How to show Chinese Characters in an English Forum
« Reply #18 on: November 23, 2008, 02:16:02 AM »
antechinus, the link shows that the working SMF installation defaults to UTF-8, not ISO-8859-1.

In a proper UTF-8 installation there should not be any problem with Arabic, or any language. The same should apply for a proper ISO installation, in this case characters are stored as entities.

From what you write and what I see, it doesn't seem to be to be a host bug but rather a Fantastico bug. If the installation was done with Fantastico, it might cause this behavior by forcing UTF-8. If it was a Fantastico installation see Sarge's reply in this topic and do an extended search for Fantastico by Sarge, you will find there the solutions for correcting this.

After this is corrected you will be able to see what kind of installation is in your working forum and take the proper decision.
  For Greek aeromodellers and our friends around the world  - Greek Button sets for SMF - Greeklish to Greek mod
Δeν αφιερώνω χρόνο για μηνύματα σε greeklish.

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,327
  • Master of BBC Abuse
Re: How to show Chinese Characters in an English Forum
« Reply #19 on: November 23, 2008, 04:06:16 AM »
Aha! Good point. I'd forgotten about that because although I installed all the demo/mirror sites I didn't do the initial installation for the main site.  Someone else did that one and he did use Fantastico and it was originally set to UTF-8. I changed the server language setting in SMF admin to plain English to get rid of the masses of errors it was generating when set on UTF-8.

Right. I'll go do some searching. Thanks for the tip. :)


ETA: Read the other topic and basically that just says I have to convert my database to UTF-8 rather than just using the trick you use. I was hoping to avoid having to do the conversion.
« Last Edit: November 23, 2008, 04:13:14 AM by antechinus »

Offline Sarge

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 6,209
  • Gender: Male
    • Zëri YT!
Re: How to show Chinese Characters in an English Forum
« Reply #20 on: November 23, 2008, 04:27:24 AM »
ETA: Read the other topic and basically that just says I have to convert my database to UTF-8 rather than just using the trick you use. I was hoping to avoid having to do the conversion.

No, you only need to do the conversion to UTF-8 if you need support for multiple languages, as agridoc mentioned:
It's a good solution for an old working forum or for ISO-8859-1 and another character set language, no need for database conversion. However, for true multilingual and many languages, UTF-8 is the proper solution.

If -- and only if -- your forum database tables are using the latin1 charset (and the latin1_swedish_ci collation by default) and your SMF installation is using UTF-8, there's still a problem here. You can fix this by deleting global_character_set as described in reply #10 in the other topic. (Be sure to select the forum database before going to the SQL box.) Whether you want to convert to UTF-8 afterwards or not... that's up to you. :) If you don't want to convert, then try agridoc's trick.
    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

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,327
  • Master of BBC Abuse
Re: How to show Chinese Characters in an English Forum
« Reply #21 on: November 23, 2008, 10:08:37 PM »
Just noting that I ran the query from the other thread and Agridocs's trick still doesn't work, so it looks like UTF-8 or nothing.

Yes, the installation is in UTF-8 and the database tables are in latin1_swedish_ci.

Offline Sarge

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 6,209
  • Gender: Male
    • Zëri YT!
Re: How to show Chinese Characters in an English Forum
« Reply #22 on: November 24, 2008, 01:57:36 AM »
Yes, the installation is in UTF-8 and the database tables are in latin1_swedish_ci.

How did you verify that the SMF installation is still in UTF-8?

The query removes global_character_set (which defaults to ISO-8859-1 if it's missing) from the smf_settings database table. But after that, you also need to switch the language from English_Utf8 to English in Admin > Server Settings > "Default Forum Language".

It's possible that you have two entries for English there, both named "English" (not "English" and "English_Utf8"). A quick way to know which to select could be to:

1. Select one of the English entries;
2. Look at the HTML source code of the page (View > Page Source in Firefox) and search for this:
Code: [Select]
option value="english"
3. See if that line is like this:
Code: [Select]
<option value="english" selected="selected">English</option>

If not, you need to select the "other" English.
    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

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,327
  • Master of BBC Abuse
Re: How to show Chinese Characters in an English Forum
« Reply #23 on: November 24, 2008, 02:09:51 AM »
Oh bother. Looks like I fluffed it. Server settings in SMF admin are plain English (have been for ages) but I thought you meant the display down in phpMyAdmin, which showed UTF-8.

I'll check the source code anyway and see what it says.

ETA: Yep, it's English alright.
« Last Edit: November 24, 2008, 02:15:10 AM by antechinus »

Offline Sarge

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 6,209
  • Gender: Male
    • Zëri YT!
Re: How to show Chinese Characters in an English Forum
« Reply #24 on: November 24, 2008, 03:06:21 AM »
Go to Admin > Forum Maintenance. In the General Maintenance section (at the top), what is the last link (the link after "Empty out unimportant logs.")? Is it "Convert the database and data to UTF-8" or is it "Convert HTML-entities to UTF-8 characters"?
    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

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,327
  • Master of BBC Abuse
Re: How to show Chinese Characters in an English Forum
« Reply #25 on: November 24, 2008, 03:27:27 AM »
It isn't either because after a little debacle a while ago I edited Admin.template.php to remove anything I didn't normally use and rearrange some of the others. :D

I can edit those links back in. Thing is at the moment I'm trying to train my co-admin to actually be a co-admin so I wanted the template fool proof. The link displayed used to be "Convert HTML-entities to UTF-8 characters". I imagine it still would be.

Offline Sarge

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 6,209
  • Gender: Male
    • Zëri YT!
Re: How to show Chinese Characters in an English Forum
« Reply #26 on: November 24, 2008, 04:07:15 AM »
[...] I edited Admin.template.php to remove anything I didn't normally use [...]

Well, you can simply check out the links in the default (Core) theme, if that's not what you're currently using. Adding ?theme=1 to the forum URL (yourforum.com/index.php) should switch -- from the theme you (as admin) are using -- to Core temporarily.
    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

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,327
  • Master of BBC Abuse
Re: How to show Chinese Characters in an English Forum
« Reply #27 on: November 24, 2008, 04:11:46 AM »
I edited the default theme admin template because all the custom themes call that template anyway.
Like I said, I can undo the edits if necessary. I'll sort it tonight and see what shows up. No big deal.

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,327
  • Master of BBC Abuse
Re: How to show Chinese Characters in an English Forum
« Reply #28 on: November 25, 2008, 01:20:59 AM »
Ok, done. It is now showing "Convert the database and data to UTF-8",
This is not the link that it used to show so obviously something has changed.

Offline helio l lopes

  • Semi-Newbie
  • *
  • Posts: 28
Re: How to show Chinese Characters in an English Forum
« Reply #29 on: December 12, 2008, 07:50:01 AM »
antechinus you can use UTF-8, otherwise you can "cheat" by changing the codepage in index.english.php to windows-1256 or ISO-8859-6.

In Multilingual in SMF 1.1RC2 without UTF for Greek and other languages? you can find more on this solution.


HI COMPUART,

My forum has the English by default but I would like that Czech users could be able to post and to see their characters as well.

I've tried the trick suggested by Agridoc but nothing works.

In phpAdmin I have the collation like this: latin1_general_ci.

Could you give a help on this, please?


Regards,

Helio