Skip to content

Commit

Permalink
Fix ReplaceUnicode()
Browse files Browse the repository at this point in the history
1. Устранен баг, из-за которого ReplaceUnicode() всегда вызывало исключение
2. Добавлена поддержка Unicode-сущностей в нижнем регистре, например \u044f
  • Loading branch information
Geograph-us committed Oct 19, 2015
1 parent e52879b commit 32b9f0c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions xNet/Html.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static string ReplaceUnicode(this string str)
return string.Empty;
}

var regex = new Regex(@"\\[uU](?<text>[0-9A-F]{4})", RegexOptions.Compiled);
var regex = new Regex(@"\\u(?<code>[0-9a-f]{4})", RegexOptions.Compiled | RegexOptions.IgnoreCase);

string result = regex.Replace(str, match =>
{
Expand Down Expand Up @@ -583,4 +583,4 @@ public static string[] Substrings(this string str, string left, string right,

#endregion
}
}
}

0 comments on commit 32b9f0c

Please sign in to comment.