BlondieMarlenne
BlondieMarlenne

Reputation: 3

Some characters fail to show using UTF-8

I am having problems getting characters from Slavic languages, like Š. When they are included in output, they appear as the diamond question mark symbol.

My database connection is set to utf8 using:

@mysql_query("SET NAMES 'utf8_unicode_ci' COLLATE 'utf8_unicode_ci'");

Most multilingual characters appear on screen. I'm not sure that I have properly set up the charset. It seems to work in Hungarian, Spanish, Portuguese, just not Slavic!

Where could the problem be?

The field has a multitude of possible characters in it, which makes it impossible to choose a specific non-utf8 charset like latin2.

This is a brand new database, created from scratch. phpMyAdmin shows the characters on screen, so I guess the problem isn't with MySQL, but is PHP. However, I have set up the proper utf8 declarations.

Upvotes: 0

Views: 2375

Answers (2)

jeff forest
jeff forest

Reputation: 698

Spent hours to check and test all the possible areas. At last I found solution here:

UTF-8 all the way through The top answer helps.

My problem found to be "Data Access". fix using

$set_utf = mysql_query("SET NAMES 'utf8' ") 
          or die(mysql_error());      

Hope it helps someone too.

Upvotes: 3

Wh1T3h4Ck5
Wh1T3h4Ck5

Reputation: 8509

Try to replace 'utf8_unicode_ci' with 'utf8_general_ci'.

E.g. I use

@mysql_query("SET NAMES 'utf8_general_ci' COLLATE 'utf8_general_ci'");

to show specific characters on my site from Serbian latin such as šđčćž and Serbian cyrillic (абвгдђежзијклљмнњопрстћуфхцчџш). I don't know if this causes your problem because I have never used 'utf8_unicode_ci'.

Put more details and some piece of code in your original question.

Upvotes: 0

Related Questions