UnknownPlayer Posted June 8, 2011 Share Posted June 8, 2011 I have problem with latin characters čćšđž, when i read from mysql and echo them in table, it show me like this: Pe�kiri is im mysql Peškiri... btw i put in my header.php, which i include, this line: <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> What is problem? Quote Link to comment Share on other sites More sharing options...
xyph Posted June 8, 2011 Share Posted June 8, 2011 Whats the character encoding of your database table? Are you sure your PHP file is UTF-8, just just the meta tag? Also, check the raw HTML and see what's being outputted. A solution without knowing the above would be to htmlentity() before you insert into the database. Quote Link to comment Share on other sites More sharing options...
UnknownPlayer Posted June 9, 2011 Author Share Posted June 9, 2011 utf8_general_ci is in base, i just put meta tag, and nothing else ? In source is same like in picture. What is solution now? How to check if php file is utf8 ? Quote Link to comment Share on other sites More sharing options...
xyph Posted June 9, 2011 Share Posted June 9, 2011 Did you try using htmlentity()? Quote Link to comment Share on other sites More sharing options...
UnknownPlayer Posted June 9, 2011 Author Share Posted June 9, 2011 I didnt, i thought there is some other solution. When i need to use that when inserting in db that field, or when read and echo ? Quote Link to comment Share on other sites More sharing options...
xyph Posted June 9, 2011 Share Posted June 9, 2011 Try when it's read and echo'ed. If that doesn't work, then it's not being stored correctly, so the easy solution would be to do it before you insert. Don't forget to specify the third, charset parameter when using htmlentities() Quote Link to comment Share on other sites More sharing options...
UnknownPlayer Posted June 10, 2011 Author Share Posted June 10, 2011 In mysql, it is correct and db is utf8_general_ci, but when i read it does not show good. Can you give me right solution please ? Quote Link to comment Share on other sites More sharing options...
UnknownPlayer Posted June 11, 2011 Author Share Posted June 11, 2011 I fond difference when you add something in mysql qith mysql INSERT command from php, and when you add from phpmyadmin. Resilts are: This is inserted from phpmyadmin, with this characters, and this does not work when i read them from mysql. But this is when i insert some text in mysql with php/mysql comman INSERT: This option works.. But how can i read items from first image, and echo them but to work ? Quote Link to comment Share on other sites More sharing options...
UnknownPlayer Posted June 11, 2011 Author Share Posted June 11, 2011 I solved this with: mysql_query("SET NAMES 'utf8'", $connection); and now everything works.. Quote Link to comment 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.