[Modify] Polish it

This commit is contained in:
sta 2018-12-13 21:33:33 +09:00
parent c164b810ff
commit 80dffde6dd

View File

@ -951,11 +951,10 @@ namespace WebSocketSharp.Net
if (s.Length == 0) if (s.Length == 0)
return s; return s;
if (encoding == null)
encoding = Encoding.UTF8;
var bytes = Encoding.ASCII.GetBytes (s); var bytes = Encoding.ASCII.GetBytes (s);
return encoding.GetString (urlDecodeToBytes (bytes, 0, bytes.Length)); return (encoding ?? Encoding.UTF8).GetString (
urlDecodeToBytes (bytes, 0, bytes.Length)
);
} }
public static string UrlDecode (byte[] bytes, Encoding encoding) public static string UrlDecode (byte[] bytes, Encoding encoding)