Files
2024-09-01 18:54:23 +05:00

7 lines
146 B
JavaScript

export function escapeUnicode(str) {
return str.replace(
/[^\0-~]/g,
c => '\\u' + ('000' + c.charCodeAt().toString(16)).slice(-4)
)
}