Reputation: 11
I have searched all over the internet for this problem that seems to be easy for others, but not for me. I have text in Cyrillic in my database, but it only shows ????. I find on the net about SET NAMES utf8 after the connection, I did that but nothing changed. I also changed the collation in the database to utf8_unicode_ci, and still the same. I also had symbols like thas one ПърватРbut I fix that with the encoding the browser(Chrome). But the text that comes from the database is still with ??????. I'm using xampp server. I'll be happy if someone help me fix this, I tried everything I found on the net.
Upvotes: 0
Views: 357
Reputation: 11
After searching for hours for the setting Cyrillic text I found the answer. It is so simple and it was my mistake. When I put the information into the database I didn't set the collation to be utf-8_unicode_ci but other. That was the mistake. I did it after that. So I solve this by creating it again but after I put any information in it I set the collation to be utf8_unicode_ci. I hope this answer will help to other like me. And I want to thank all of you who tried to help me.
Upvotes: 1
Reputation: 13890
Make sure MySQL returns results in UTF-8. Use the following MysqL command:
SET CHARACTER SET utf8;
Command SET NAMES
does not affect data sent to use by MySQL. It just tells MySQL, that your queries will use UTF-8.
Also make sure that browser knows that your page use 'UTF-8'. Usually this is done by adding ;charset=utf8-8
to Content-Type
header field like this:
ContentType: text/html; charset=utf-8
Upvotes: 1