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,467
  • 20
  • 65
  • 107

2 Answers2

4
$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,614
  • 12
  • 11
1
$str = '"\u0627\u0644\u0631\u0626\u064a\u0633"';

echo json_decode($str);
Gazler
  • 81,193
  • 17
  • 276
  • 242