David
David

Reputation: 509

PHP and MySQLi UTF8

I have some tables that are set to utf8_general_ci and am using PHP's mysqli driver, with charset set to 'utf8'. I have the default_charset also set to UTF-8

However, characters are being replaced with '\u0101l'

Any idea what this is or how to fix it? Before I didn't have mysqli using utf8 and it just showed a question mark, not a diamond question mark - just a regular '?'

Thank you!

Upvotes: 0

Views: 904

Answers (1)

the_wizard
the_wizard

Reputation: 592

I'm pretty sure you are using "htmlentities()" or "html_entity_decode()" somewhere. The issue is, htmlentities() is still trying to interpret its input to ISO-8859-1, while html_entity_decode() is now defaulting to UTF-8. Solution: If you are using any of these functions listed above, explicitly specify the encoding type every time. I had this problem and a co-worker of mine wrote an article on the subject also http://lab.clearpixel.com.au/2012/01/html-entity-character-conversion-in-php/

I hope it helps

Upvotes: 1

Related Questions