I've got the following double byte utf8 character
\ud83d\ude04
(It's an ios emoji). I want to convert to a utf-16
U+1F604
How do I do this? I've tried the following:
$utf8_string = "\ud83d\ude04";
$utf16_string = mb_convert_encoding($utf8_string, 'UTF-16', 'UTF-8');
But I get the original utf8 string. It doesnt get converted.
I'm thinking I may need to decode the utf8 string first. I've tried doing this with json_decode (which works quite nicely to decode utf8 character sets). But still no joy.
\u...is not UTF-8 andU+...is not UTF-16. The former looks like a JSON encoded representation of the character and the latter looks like a formal Unicode code point. Neither is a UTF encoding.