JeditL Posted July 27, 2009 Share Posted July 27, 2009 Hi, I can't get PHP to display letters ä and ö that are brought from database correctly. It's fine if I just echo the letters but getting letters to show correctly from database is causing problems. $str = utf8_decode($str); works fine with PHP strings but not with strings from MySQL. Please help. I really should get this to work. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/167606-solved-foreign-letters-stored-in-database-like-scandinavian-%C3%A4-and-%C3%B6/ Share on other sites More sharing options...
JonnoTheDev Posted July 27, 2009 Share Posted July 27, 2009 Are they stored correctly in your database? Are you using UTF-8 content-type header. Use mysql_query("SET NAMES UTF8"); when conneting to your database. Quote Link to comment https://forums.phpfreaks.com/topic/167606-solved-foreign-letters-stored-in-database-like-scandinavian-%C3%A4-and-%C3%B6/#findComment-884007 Share on other sites More sharing options...
JeditL Posted July 28, 2009 Author Share Posted July 28, 2009 Use mysql_query("SET NAMES UTF8"); when conneting to your database. Thanks, mate. That did the trick. All the letters are now shown correctly. Cheers! Quote Link to comment https://forums.phpfreaks.com/topic/167606-solved-foreign-letters-stored-in-database-like-scandinavian-%C3%A4-and-%C3%B6/#findComment-884644 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.