Today we used regular expressions to determine preg_replace replacement, such as \u5c71\u4e1c, which is escaped by jquery, but sometimes Chinese problems still occur. Let’s take a look at the solution
代码如下 | 复制代码 |
$code = json_encode($str); $code = preg_replace("#u([0-9a-f]+)#ie", "iconv('UCS-2', 'UTF-8', pack('H4', '1'))", $code); ?> |