StringBuilder sb = new StringBuilder ();
foreach (char c in unescapedExpression) {
- if (charsToEscape.Contains (c)) {
+ if (charsToEscape.Contains (c))
sb.AppendFormat ("%{0:x2}", (int) c);
- } else
+ else
sb.Append (c);
}
return sb.ToString ();
}
+
+ // FIXME: add tests for this
+ internal static string Unescape (string escapedExpression)
+ {
+ StringBuilder sb = new StringBuilder ();
+
+ int i = 0;
+ while (i < escapedExpression.Length) {
+ sb.Append (Uri.HexUnescape (escapedExpression, ref i));
+ }
+
+ return sb.ToString ();
+ }
}
}