How do you get the glyph for a character encoded as 'ō' from a utf-8 encoded database field usi

Posted by AE on Stack Overflow See other posts from Stack Overflow or by AE
Published on 2010-04-22T03:55:09Z Indexed on 2010/04/22 4:03 UTC
Read the original article Hit count: 365

I have a MySQL database table with a collation of 'utf8_general_ci' and the value in the field is:

x & #299; bán yá wén (without the spaces).

When this is converted (for example by StackOverflow's editor) it looks like this:

xī bán yá wén

where the second character looks like a lower case i with a bar over the top.

In PHP, what function converts the & #299 ; entity into the ī character?

I've tried using html_entity_decode($str,ENT_COMPAT,'UTF-8'), however I get characters like the following:

yÄ«n wén or zhÅ•ng wén

I'm pretty sure there's something I don't understand about the decoding, which is why I'm using the wrong function. Can anyone shed some light on how to get the single character glyph that's represented by the entity & #299 and similar high-number characters above 255?

Many thanks, AE

© Stack Overflow or respective owner

Related posts about php

Related posts about encoding