Arus Posted February 1, 2007 Share Posted February 1, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/36670-japanese-display-problem-shift-jis/ Share on other sites More sharing options...
ShogunWarrior Posted February 1, 2007 Share Posted February 1, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/36670-japanese-display-problem-shift-jis/#findComment-174819 Share on other sites More sharing options...
realjumper Posted February 1, 2007 Share Posted February 1, 2007 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"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/36670-japanese-display-problem-shift-jis/#findComment-174912 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.