我的数据格式如下:U+597D
或类似这样的 U+6211
.我想将它们转换为 UTF-8(原始字符是好和我).我该怎么做?
I have my data in this format: U+597D
or like this U+6211
. I want to convert them to UTF-8 (original characters are 好 and 我). How can I do it?
$utf8string = html_entity_decode(preg_replace("/U+([0-9A-F]{4})/", "&#x\1;", $string), ENT_NOQUOTES, 'UTF-8');
可能是最简单的解决方案.
is probably the simplest solution.
这篇关于PHP:将 unicode 代码点转换为 UTF-8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!