Home Notices Documents Classes Download Others Rice
Classes  >  encoder  >  UrlEncode(string)
encoder class : UrlEncode(string) method

Description

Encodes a string using URL encoding.

Syntax

encoderInstance.UrlEncode(string anyString)

Arguments

ClassNameDescription
stringanyStringA string.

Return value

ClassDescription
stringA string encoded by URL encoding.

Sample code

1:

encoder e = new encoder();

2:

string any = "日本語";

3:

string encoded = e.UrlEncode(any); // The result is "%E6%97%A5%E6%9C%AC%E8%AA%9E".

Notes

It's a wrapper of the System.Web.HttpUtility.UrlEncode(String) method.

This method will encode using UTF-8.

Links for reference

Copyright © Rice All rights reserved.