From 2935c8e1cf04e36104af6d62ed33a7580d01311a Mon Sep 17 00:00:00 2001 From: sta Date: Sat, 12 Jan 2019 22:23:00 +0900 Subject: [PATCH] [Modify] Move it --- websocket-sharp/Net/HttpUtility.cs | 46 +++++++++++++++--------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/websocket-sharp/Net/HttpUtility.cs b/websocket-sharp/Net/HttpUtility.cs index 02826b1c..c05482f1 100644 --- a/websocket-sharp/Net/HttpUtility.cs +++ b/websocket-sharp/Net/HttpUtility.cs @@ -1030,6 +1030,29 @@ namespace WebSocketSharp.Net : String.Empty; } + public static string UrlEncode (string s) + { + return UrlEncode (s, Encoding.UTF8); + } + + public static string UrlEncode (string s, Encoding encoding) + { + if (s == null) + throw new ArgumentNullException ("s"); + + var len = s.Length; + if (len == 0) + return s; + + if (encoding == null) + encoding = Encoding.UTF8; + + var bytes = new byte[encoding.GetMaxByteCount (len)]; + var realLen = encoding.GetBytes (s, 0, len, bytes, 0); + + return Encoding.ASCII.GetString (urlEncodeToBytes (bytes, 0, realLen)); + } + public static string UrlEncode (byte[] bytes, int offset, int count) { if (bytes == null) @@ -1059,29 +1082,6 @@ namespace WebSocketSharp.Net : String.Empty; } - public static string UrlEncode (string s) - { - return UrlEncode (s, Encoding.UTF8); - } - - public static string UrlEncode (string s, Encoding encoding) - { - if (s == null) - throw new ArgumentNullException ("s"); - - var len = s.Length; - if (len == 0) - return s; - - if (encoding == null) - encoding = Encoding.UTF8; - - var bytes = new byte[encoding.GetMaxByteCount (len)]; - var realLen = encoding.GetBytes (s, 0, len, bytes, 0); - - return Encoding.ASCII.GetString (urlEncodeToBytes (bytes, 0, realLen)); - } - public static byte[] UrlEncodeToBytes (byte[] bytes) { if (bytes == null)