Home Notices Documents Classes Download Others Rice
Classes  >  encoder  >  UrlEncode(string,string)
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

ClassNameDescription
stringanyStringA string.
stringencodingNameA encoding name.

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, "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.

Links for reference

Copyright © Rice All rights reserved.