Expose\Converter\ConvertJS::convertFromJSUnicode PHP Method

convertFromJSUnicode() public method

This method converts JS unicode code points to regular characters
public convertFromJSUnicode ( string $value ) : string
$value string the value to convert
return string
    public function convertFromJSUnicode($value)
    {
        $matches = array();
        preg_match_all('/\\\\u[0-9a-f]{4}/ims', $value, $matches);
        if (!empty($matches[0])) {
            foreach ($matches[0] as $match) {
                $chr = chr(hexdec(substr($match, 2, 4)));
                $value = str_replace($match, $chr, $value);
            }
            $value .= "\n\\u0001";
        }
        return $value;
    }