I just can't understand it, but here is my situation.
I have this peace of code:
someFunction: function(content){
content = content.substr(19005,24);
console.log('content is: '+content);
content = decodeURIComponent(content);
console.log(typeof content, content);
var string = '\u0430\u0437\u0443\u0439';
string = decodeURIComponent(string);
console.log(typeof string, string);
}
And when I run this on my node.js server it returns this "abnormal" result:
content is: \u0430\u0437\u0443\u0439
string \u0430\u0437\u0443\u0439 // but should be "string азуй" as below
string азуй
So, how is it actually possible??
1) The same content
2) The same variable type
3) The same (decodeURIComponent) function
- but different results???
P.S. The only difference I see is in origin of content
and string
vars. But is this play a role?