Sample code for 30+ languages & platforms
C#

URL Encoding and Decoding

Demonstrates URL encoding/decoding using the HTTP convenience methods.

Chilkat C# Downloads

C#
Chilkat.Http http = new Chilkat.Http();

string s = "Hello World! 100% sure.";

string encoded = http.UrlEncode(s);
Debug.WriteLine("URL encoded: " + encoded);

//  Space → %20
//  ! → %21
//  % → %25

string decoded = http.UrlDecode(encoded);
Debug.WriteLine("URL decoded: " + decoded);

//  Output:

//  URL encoded: Hello%20World%21%20100%25%20sure.
//  URL decoded: Hello World! 100% sure.