1

i have a string like that

"\u041b\u0430\u0440\u0430 \u041a\u0440\u043e\u0444\u0442: \u0420\u0430\u0441\u0445\u0438\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u0438\u0446\u0430 \u0433\u0440\u043e\u0431\u043d\u0438\u0446"

This is the name of the film "Tomb Rider" but it is Russian, i need to convert it to a normal Russian string, which will be looks like "Лара Крофт".

doru
  • 9,022
  • 2
  • 33
  • 43
aGoodRussianGuy
  • 173
  • 1
  • 1
  • 11

2 Answers2

0

These are Unicode characters, if you wish to decode them in javascript you should remove the leading \u and then utilize String.fromCharCode(parseInt(unicodeVariable, 16));

You can replace all instances of '\u' using REGEX or string literal approach, below is the latter.

var str = "\u041b\u0430\...\u0446"
str.split("\u").join("")
0

Just splitting and joining only works if there are no other characters. For your string, this answer can be used as-is.

Community
  • 1
  • 1
CaringDev
  • 8,391
  • 1
  • 24
  • 43