bedeabc Posted September 22, 2009 Share Posted September 22, 2009 Hi everyone, I'm a member of a couple of web design forums, but now that I'm dealing with PHP regularly I've decided to join this dedicated php forum. The site I'm working on isn't displaying Polish characters correctly. The site draws its content from MySQL. It's bilingual and uses seperate tables for English and Polish content. The whole database's collation is utf8_general_ci and I've put the following in the page <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> The file was saved as UTF8 (without BOM) yet polish characters are not displayed correctly. Should I be using BOM? The polish text was entered straight into phpmyadmin. I have tried using <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-2" /> This causes some polish characters to be displayed, but not all of them. I've also tried changing the database collation. I can provide the URL and source if needed. Any help would be greatly appreciated! Bede Quote Link to comment https://forums.phpfreaks.com/topic/175099-polish-character-issues-with-phpmysql-and-utf-8/ Share on other sites More sharing options...
JonnoTheDev Posted September 22, 2009 Share Posted September 22, 2009 After you connect to the database run the following query mysql_query("SET NAMES 'UTF-8'"); Quote Link to comment https://forums.phpfreaks.com/topic/175099-polish-character-issues-with-phpmysql-and-utf-8/#findComment-922869 Share on other sites More sharing options...
Bricktop Posted September 22, 2009 Share Posted September 22, 2009 Hi bedeabc, Also, if you're outputting the data via another PHP function (such as html_enttities_decode or similar) you need to specifiy an encoding type to the function. If you post your code we could give a more definite answer. Quote Link to comment https://forums.phpfreaks.com/topic/175099-polish-character-issues-with-phpmysql-and-utf-8/#findComment-922879 Share on other sites More sharing options...
thebadbad Posted September 22, 2009 Share Posted September 22, 2009 After you connect to the database run the following query mysql_query("SET NAMES 'UTF-8'"); along with mysql_query("SET CHARACTER SET 'utf8'"); I've always used utf8 when setting the names and character set, so I can't say if the UTF-8 variant will work, but I guess it will Quote Link to comment https://forums.phpfreaks.com/topic/175099-polish-character-issues-with-phpmysql-and-utf-8/#findComment-922886 Share on other sites More sharing options...
bb2120 Posted September 22, 2009 Share Posted September 22, 2009 Thank you for all your helpful replies. I've added the two queries mentioned and everything seems to be working as it should. Thanks again! Bede P.S. I assume the captcha will stop nagging me after I've made a few more posts? And how do I mark the question as solved? Quote Link to comment https://forums.phpfreaks.com/topic/175099-polish-character-issues-with-phpmysql-and-utf-8/#findComment-922975 Share on other sites More sharing options...
thebadbad Posted September 22, 2009 Share Posted September 22, 2009 You have two users?? Quote Link to comment https://forums.phpfreaks.com/topic/175099-polish-character-issues-with-phpmysql-and-utf-8/#findComment-923022 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.