public static byte[] UrlEncodeUnicodeToBytes(string str) { if (str == null) return null; if (str.Length == 0) return new byte[0]; MemoryStream result = new MemoryStream(str.Length); foreach (char c in str) { HttpEncoder.UrlEncodeChar(c, result, true); } return result.ToArray(); }
public static byte[] UrlEncodeUnicodeToBytes(string str) { if (str == null) { return(null); } if (str.Length == 0) { return(new byte[0]); } MemoryStream result = new MemoryStream(str.Length); for (var index = 0; index < str.Length; index++) { HttpEncoder.UrlEncodeChar(str[index], result, true); } return(result.ToArray()); }
public static byte[] UrlEncodeUnicodeToBytes(string str) { if (str == null) { return(null); } if (str.Length == 0) { return(new byte[0]); } var result = new MemoryStream(str.Length); foreach (char c in str) { HttpEncoder.UrlEncodeChar(c, result, true); } return(result.ToArray()); }