When I load my data from my model (asp.net model) if the string is in another language (Russian for example), I'm getting the unicode hex code of the chars. How can I convert them to a normal string? The problem isn't from the javascript encoding, it's from loading it from the model. I tried using a lot of functions from the forum but none worked: Here is an example of a value I should get:
Петър
And here is what I'm actually getting:
Петър
const sequence = 'Петър' const charCode = sequence.split(/[;\s]+/g) // remove empty.filter((v) => v) // П -> 0x41F -> number.map((v) => Number.parseInt(v.replace(/&#/, '0'))) console.log( String.fromCharCode(...charCode) )
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.