G
geordino99
hello everybody,
I am getting some text from another website and the returned text is
returned in unicode like this "\\u0421\\u0442\\u0435\\u0444\\u0430\
\u043d \\u0425\\u0435"
I am trying to display this text in Javascript but it doesn't work
var txt => contains the returned text
alert(txt); // Displays texts correctly
someDiv.innerHTML = txt; //display the following:
\u0421\u0442\u0435\u0444\u0430\u043d \u0425\u0435
I tried the following but without success:
someDiv.innerHTML = eval( 'x="' + txt + '";');
if I define txt explicitly in javascript like this:
txt = "\\u0421\\u0442\\u0435\\u0444\\u0430\\u043d \\u0425\\u0435";
then it works
but when the txt is being loaded from the server using ajax it doesnt
work
I am using UTF-8 encoding in my html and ajax requests
any idea?
I am getting some text from another website and the returned text is
returned in unicode like this "\\u0421\\u0442\\u0435\\u0444\\u0430\
\u043d \\u0425\\u0435"
I am trying to display this text in Javascript but it doesn't work
var txt => contains the returned text
alert(txt); // Displays texts correctly
someDiv.innerHTML = txt; //display the following:
\u0421\u0442\u0435\u0444\u0430\u043d \u0425\u0435
I tried the following but without success:
someDiv.innerHTML = eval( 'x="' + txt + '";');
if I define txt explicitly in javascript like this:
txt = "\\u0421\\u0442\\u0435\\u0444\\u0430\\u043d \\u0425\\u0435";
then it works
but when the txt is being loaded from the server using ajax it doesnt
work
I am using UTF-8 encoding in my html and ajax requests
any idea?