function _twig_escape_js_callback($matches) {
$char = $matches[0];
// \xHH
if (!isset($char[1])) {
return '\\x' . substr('00' . bin2hex($char), -2);
}
// \uHHHH
$char = twig_convert_encoding($char, 'UTF-16BE', 'UTF-8');
return '\\u' . substr('0000' . bin2hex($char), -4);
}