Reputation: 87
I am calling a .txt file from a jquery ajax call. It has some special characters like ±
. This ±
is a delimiter for a set of array; data I want to split out and push into a JavaScript array.
It is not treated as ±
symbol when interpreted like this.
How do I get that data as just like browser content?
Upvotes: 3
Views: 1329
Reputation: 84493
you could use the escape()
value to split a string. for ± i found two values (maybe there are more?).
var string = escape('test±test2±test3');
var split = string.split('%C2%B1');
alert(split); // test,test2,test3
// %B1%0A is the value i found for ±
// %C2%B1 is the value escape() gives me when i just copy and paste that char :)
Upvotes: 2