diff --git a/csharp/DiffMatchPatch.cs b/csharp/DiffMatchPatch.cs index 6e196418..b01fa585 100644 --- a/csharp/DiffMatchPatch.cs +++ b/csharp/DiffMatchPatch.cs @@ -1,4 +1,4 @@ -/* +/* * Diff Match and Patch * Copyright 2018 The diff-match-patch Authors. * https://github.com/google/diff-match-patch @@ -19,11 +19,12 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Net; using System.Text; using System.Text.RegularExpressions; -using System.Web; namespace DiffMatchPatch { + internal static class CompatibilityExtensions { // JScript splice function public static List Splice(this List input, int start, int count, @@ -1474,7 +1475,7 @@ public List diff_fromDelta(string text1, string delta) { // decode would change all "+" to " " param = param.Replace("+", "%2b"); - param = HttpUtility.UrlDecode(param); + param = WebUtility.UrlDecode(param); //} catch (UnsupportedEncodingException e) { // // Not likely on modern system. // throw new Error("This system does not support UTF-8.", e); @@ -2249,7 +2250,7 @@ Regex patchHeader } line = text[textPointer].Substring(1); line = line.Replace("+", "%2b"); - line = HttpUtility.UrlDecode(line); + line = WebUtility.UrlDecode(line); if (sign == '-') { // Deletion. patch.diffs.Add(new Diff(Operation.DELETE, line)); @@ -2282,7 +2283,7 @@ Regex patchHeader */ public static string encodeURI(string str) { // C# is overzealous in the replacements. Walk back on a few. - return new StringBuilder(HttpUtility.UrlEncode(str)) + return new StringBuilder(WebUtility.UrlEncode(str)) .Replace('+', ' ').Replace("%20", " ").Replace("%21", "!") .Replace("%2a", "*").Replace("%27", "'").Replace("%28", "(") .Replace("%29", ")").Replace("%3b", ";").Replace("%2f", "/")