Skip to content

Instantly share code, notes, and snippets.

@vwrs
Created March 10, 2023 09:48
Show Gist options
  • Save vwrs/2d3e24638fcf664a88061a82ac3721f4 to your computer and use it in GitHub Desktop.
Save vwrs/2d3e24638fcf664a88061a82ac3721f4 to your computer and use it in GitHub Desktop.
convert unicode characters to string
// ref: https://stackoverflow.com/questions/17267329/converting-unicode-character-to-string-format
function unicodeToChar(text) {
return text.replace(/\\u[\dA-F]{4}/gi,
function (match) {
return String.fromCharCode(parseInt(match.replace(/\\u/g, ''), 16));
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment