Jump to content

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");

?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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