开发者

How to transfer `\u0627` into utf-8(php) [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicate:

How to decode Unicode escape sequences like “\u00ed” to proper UTF-8 encoded character开发者_Python百科s?

$str = '\u0627\u0644\u0631\u0626\u064a\u0633';

How to transfer it into utf-8? thanks.


$str = '\u0627\u0644\u0631\u0626\u064a\u0633';
$converted = preg_replace('/\\\u([0-9a-z]{4})/i', '&#x$1;', $str);
echo $converted;  // displays الرئيس


$str = '"\u0627\u0644\u0631\u0626\u064a\u0633"';

echo json_decode($str);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜