public static string UrlPathEncode(string str) { if (string.IsNullOrEmpty(str)) { return(str); } int num = str.IndexOf('?'); if (num >= 0) { return(XmlaHttpUtility.UrlPathEncode(str.Substring(0, num)) + str.Substring(num)); } return(XmlaHttpUtility.UrlEncodeSpaces(XmlaHttpUtility.UrlEncodeNonAscii(str, Encoding.UTF8))); }
private static string UrlEncodeNonAscii(string str, Encoding e) { if (string.IsNullOrEmpty(str)) { return(str); } if (e == null) { e = Encoding.UTF8; } byte[] bytes = e.GetBytes(str); byte[] bytes2 = XmlaHttpUtility.UrlEncodeNonAscii(bytes, 0, bytes.Length, false); return(Encoding.ASCII.GetString(bytes2)); }