Shadow Jolteon Posted May 28, 2009 Share Posted May 28, 2009 Hello there. =) Earlier today I needed to get Japanese characters working when entering and displaying text from the database in PHP... I used the instructions here to do so, and it works great. Then I discovered a problem with this: A lot of special characters that were working before (such as the accented é) are now showing up as random characters. I'm not quite sure how to go about fixing this, so I can have both those characters and the Japanese characters... Any help with this would be greatly appreciated. =) Edit: Also, it seems to only happen when those characters are submitted to the database using PHP. If I enter them directly through phpMyAdmin, they show up just fine when displayed using PHP.. Quote Link to comment https://forums.phpfreaks.com/topic/159997-certain-special-characters-no-longer-working/ Share on other sites More sharing options...
JonnoTheDev Posted May 28, 2009 Share Posted May 28, 2009 Are you sure you have the correct header on the page? header('Content-Type: text/html; charset=utf-8'); Quote Link to comment https://forums.phpfreaks.com/topic/159997-certain-special-characters-no-longer-working/#findComment-843963 Share on other sites More sharing options...
Shadow Jolteon Posted May 28, 2009 Author Share Posted May 28, 2009 Yes, I'm certain that's correct. Just checked to make sure. =) Also, not sure if you caught the edit in my post or not (since I edited it right before you posted): Edit: Also, it seems to only happen when those characters are submitted to the database using PHP. If I enter them directly through phpMyAdmin, they show up just fine when displayed using PHP.. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/159997-certain-special-characters-no-longer-working/#findComment-843968 Share on other sites More sharing options...
JonnoTheDev Posted May 28, 2009 Share Posted May 28, 2009 Try converting the character before storing in db $var = mb_convert_encoding($_POST['var'], "UTF-8", "auto"); You will need the mb_string extensions loaded in php Quote Link to comment https://forums.phpfreaks.com/topic/159997-certain-special-characters-no-longer-working/#findComment-843996 Share on other sites More sharing options...
Shadow Jolteon Posted May 29, 2009 Author Share Posted May 29, 2009 Nope, that doesn't seem to work, either.. =/ I've noticed that in certain places it seems to work fine, while in others (of course, the ones I really need it working at), it does not.. I've looked at a few different areas where it is and is not working and don't see any difference in how they are submitted.. Quote Link to comment https://forums.phpfreaks.com/topic/159997-certain-special-characters-no-longer-working/#findComment-844747 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.