public static void Main()
Console.WriteLine(System.Web.HttpUtility.UrlEncode("%"));
public static class HttpUtility
public static string UrlEncode(string url)
StringBuilder sb = new StringBuilder();
if (!string.IsNullOrEmpty(url))
sb.Append(((int)c).ToString("X2"));
private static bool IsUrlSafeChar(char c)
char[] safePunct = new char[] { '(', ')', '*', '-', '.', '!', '_' };
return ((c >= 'a' && c <= 'z') ||
(c >= 'A' && c <= 'Z') ||
(c >= '0' && c <= '9') ||