Jump to content

Japanese display problem (Shift-JIS)


Arus

Recommended Posts

Created a page that is html encoded to be Japanese Shift-JIS , but for some reason, the page is rendering the browser as Japanese EUC. The page is used to display ranks drawn from data files that users submit to.

 

This is only happening on pages that are php; the rest of the files on my server (html) are showing up fine in the browser.

 

What would cause the php pages to cause the browsers (tested this in firefox 2.0 , firefox 1.5, IE 6 and IE 7, Opera and an old version of Netscape), to rever to EUC instead of picking up the encoding for Shift-JIS?

Link to comment
https://forums.phpfreaks.com/topic/36670-japanese-display-problem-shift-jis/
Share on other sites

Could you preface the page with the encoding header?

PHP has all sorts of problems with encodings, you could output the content-type:

header("Content-type: text/html;charset=Shift-JIS);

** I have "Shift-JIS" in here but I'm not sure if this is the correct encoding name.

I had a tremendous problem with this, althoughI am using the charset=x-sjis rather than Shift-JIS....however, I know the problem and it's frustrating. I found that the pages would display ok (provided I declared the charset at the head of each page UNTILL I needed data from or to the database. It was the DB that was spoling it. Research found the cure for me, and I hope it cures it for you........

 

In your connection string you need to add....

 

mysql_query("SET CHARACTER SET sjis");

 

 

So your complete connection looks like...

 

<?php

// Make a MySQL Connection
mysql_pconnect("localhost", "username", "password") or die(mysql_error());
mysql_select_db("my_database") or die(mysql_error());

mysql_query("SET CHARACTER SET sjis");

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.