Last active
June 30, 2018 09:45
-
-
Save dmjcomdem/e3bfbecf9d9ac4702d337853d47a66ba to your computer and use it in GitHub Desktop.
Перевод html сущности в utf-8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let decodeHtmlEntity = (str) => { | |
return str.replace(/&#?x(.+?);/gi, (match, dec) => String.fromCharCode('0x' + dec)); | |
}; | |
// decodeHtmlEntity('БУ ХМАО-Югры МИАЦ') | |
// "БУ ХМАО-Югры МИАЦ" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment