Advertisement
plagu33

json reemplazar caracteres

Jul 10th, 2014
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.26 KB | None | 0 0
  1. $str = json_encode($string);
  2. $str = preg_replace_callback('/\\\\u([0-9a-f]{4})/i', 'replace_unicode_escape_sequence', $str);
  3. echo $str;
  4.  
  5. function replace_unicode_escape_sequence($match) {
  6.     return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement