encoder class : UrlEncode(string,string) method
Description
Encodes a string using URL encoding and specified character encoding.
Syntax
encoderInstance.UrlEncode(string anyString, string encodingName)
Arguments
Class | Name | Description |
string | anyString | A string. |
string | encodingName | A encoding name. |
Return value
Class | Description |
string | A string encoded by URL encoding. |
Sample code
1: | encoder e = new encoder(); |
2: | string any = "日本語"; |
3: | string encoded = e.UrlEncode(any, "shift_jis"); // The result is "%93%FA%96%7B%8C%EA". |
Notes
It's a wrapper of the System.Web.HttpUtility.UrlEncode(String,Encoding) method.