我正在尝试用PHP将Unicode字符转换为文本。但是字符串是Unicode字符和文本的混合体。但它不起作用。
我关注了这个链接(PHP字符串中的Unicode字符)
<?php
$unicodeChar = "{'singer': u'', 'name': u'''''u101c''''u1031''''u1011''''u1032''''u101c''''u103d''''u103e''''u1004''''u1037''''u103a''''u101c''''u102d''''u102f''''u1000''''u103a'}''r''n''r''n artist : Thar Gyi''r''n album : Sal Pone Ta Pone''r''n genre : R&B''r''n copyright : MyanmarSongs.NET''r''n track : 1''r''n title : Lay Htal Hlwint Lite";
echo json_decode('"'.$unicodeChar.'"');
echo mb_convert_encoding($unicodeChar, 'UTF-8', 'HTML-ENTITIES');
echo mb_convert_encoding($unicodeChar, 'UTF-8', 'UTF-16BE'); showing nothing
?>
当值像我使用的那样是Unicode字符和文本的混合物时,上述所有场景都不起作用。但当价值如此简单时,它就起作用了:
$unicodeChar = ''u1000';
echo json_decode('"'.$unicodeChar.'"');
我怎样才能做到这一点?
使用以下代码
$unicodeChar = ''u1000';
echo json_decode('"'.$unicodeChar.'"');