1

Possible Duplicate:
How to decode Unicode escape sequences like “\u00ed” to proper UTF-8 encoded characters?

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

How to transfer it into utf-8? thanks.

Community
  • 1
  • 1
cj333
  • 2,547
  • 20
  • 67
  • 110

2 Answers2

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

echo json_decode($str);
Gazler
  • 83,029
  • 18
  • 279
  • 245