homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Search Engines / Asia and Pacific Region
Forum Library, Charter, Moderators: bill

Asia and Pacific Region Forum

php GB2312 UTF-8 issue
php GB2312 UTF-8 issue

 1:17 pm on Oct 10, 2007 (gmt 0)

Hi - I have a Chinese site that had its charset as UTF-8. we are storing text as UTF-8 in MySQL5 db. Quite a few of my users in China that have GB2312 encoding set in their IE browsers can't see the site. We changed the charset in ph to be GB2312 but some characters are coming out odd like as? (question marks).

We would like to store as UTF-8 and display as GB2312 - but without the funny chars.

Please help!



 12:34 am on Oct 11, 2007 (gmt 0)

Those are 2 completely different character set encodings. To the best of my knowledge you need to choose one or the other. Simply changing the charset will cause more problems than it will solve.

If you use a proper DTD, language and charset declaration meta tags your users should have no difficulty seeing UTF-8 pages at all. What do your headers look like? Could you post a snippet?


 9:36 am on Oct 11, 2007 (gmt 0)

Hi Header is <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

we have also tried using meta language zh

the site is ok in Firefox but can't be seen in IE


 12:19 am on Oct 12, 2007 (gmt 0)

That's fine for declaring UTF-8 as the charset, but what DTD are you using? How are you declaring the language?

Here's how I do one of my Chinese sites:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh" />

Note the language declaration in the HTML tag. That helps the most.


 9:26 am on Oct 12, 2007 (gmt 0)

Hi - but are Chinese users that only have gb2312 browser encoding able to see the site properly?

Do you have a url for your site so I can see if my users who can't see mine properly can see that?

Thanks for help


 12:30 pm on Oct 12, 2007 (gmt 0)

Hi - but are Chinese users that only have gb2312 browser encoding able to see the site properly?

The site's been tested with IE5, IE6, IE7, Opera, Firefox, and Safari. I've tested it with Traditional and Simplified Chinese operating systems (Windows & Mac) as well as Japanese and English. The site has never failed to show up in that range of software and operating systems.


Sorry, we're not alowed to post URLs to our own sites or example sites at WebmasterWorld.


 12:40 pm on Oct 12, 2007 (gmt 0)

cheers Bill - can you send me URL in private message?

We are really stuck on this and its casuing quite serious downtime.


 11:33 pm on Oct 12, 2007 (gmt 0)

Let's keep the conversation in the forums. Why not post a snippet of code from your site as I suggested in my first message? I even posted an example of the code I was looking for from your site.

This isn't a question of looking at example sites, but rather standard code and possibly your server setup. As you say in your first post, your data is in UTF-8 already. You're probably using PHP too, correct? Do you have mbstring setup properly?

Again, a snippet from your code might help our understanding of your issue. Another thing you might want to try is to check whether your HTML is valid with a validator [validator.w3.org].

Global Options:
 top home search open messages active posts  

Home / Forums Index / Search Engines / Asia and Pacific Region
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved