jamerson Posted June 25, 2008 Share Posted June 25, 2008 Hi, this has me stumped. I have a mysql database setup with UTF-8 Unicode as the collation. In one of the tables I have some Japanese text. MyPHP displays it beautifully no problems at all. I have a php script that simply does a SELECT * from the table and then sticks the output into the web browser. However for the life of me I cannot get that output to be Japanese, it's just ????. I've inserted a meta tag with charset=utf-8, I've even set the header via php header('Content-Type:text/html; charset=UTF-8');, set the internal encoding to utf-8. So as you can see I'm clutching at straws here. Now the really annoying thing is that if I just paste the Japanese text into the body area of the html page, that displays just fine as well. So what on earth am I doing wrong here, should I be telling php to expect utf-8 out of the database or does it just get that automatically? Please help, it's driving me nuts! Jamerson ??? Link to comment https://forums.phpfreaks.com/topic/111915-solved-utf-8-japanese-text-from-mysql-wont-display/ Share on other sites More sharing options...
effigy Posted June 25, 2008 Share Posted June 25, 2008 Are you telling MySQL what to use? Link to comment https://forums.phpfreaks.com/topic/111915-solved-utf-8-japanese-text-from-mysql-wont-display/#findComment-574452 Share on other sites More sharing options...
jamerson Posted June 25, 2008 Author Share Posted June 25, 2008 Aaah, nope I wasn't I had assumed that the collate had that all covered. mysql_query("SET NAMES 'utf8'"); mysql_query("SET CHARACTER SET 'utf8'"); does the trick perfectly. Thanks very much! Jamerson Link to comment https://forums.phpfreaks.com/topic/111915-solved-utf-8-japanese-text-from-mysql-wont-display/#findComment-574473 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.