/// <summary> The global unescape method, as per ECMA-262 15.1.2.5.</summary> private object js_unescape(object [] args) { string s = ScriptConvert.ToString(args, 0); int firstEscapePos = s.IndexOf((char)'%'); if (firstEscapePos >= 0) { int L = s.Length; char [] buf = s.ToCharArray(); int destination = firstEscapePos; for (int k = firstEscapePos; k != L;) { char c = buf [k]; ++k; if (c == '%' && k != L) { int end, start; if (buf [k] == 'u') { start = k + 1; end = k + 5; } else { start = k; end = k + 2; } if (end <= L) { int x = 0; for (int i = start; i != end; ++i) { x = ScriptConvert.XDigitToInt(buf [i], x); } if (x >= 0) { c = (char)x; k = end; } } } buf [destination] = c; ++destination; } s = new string (buf, 0, destination); } return(s); }