Double-Escaped Unicode Javascript Issue -


i having problem displaying javascript string embedded unicode character escape sequences (\uxxxx) initial "\" character escaped "\" need transform string evaluates escape sequences , produces output correct unicode character?

for example, dealing input such as:

"this \u201ctest\u201d";

attempting decode "\" using regex expression, e.g.:

var out  = text.replace('/\/g','\');

results in output text:

"this \u201ctest\u201d";

that is, unicode escape sequences displayed actual escape sequences, not double quote characters like.

as turns out, it's unescape() want, '%uxxxx' rather '\uxxxx':

unescape(yourteststringhere.replace(/\/g,'%'))


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -