Topic Path: Symbol Reference > Classes > TIdURI Class > TIdURI Methods > URLEncode Method
TIdURI.URLEncode Method

Converts a US-ASCII string to a URL-Encoded string.

class function URLEncode(
    const ASrc: string
): string;
US-ASCII string to be encoded. 

String - URL-encoded representation of the string.

URLEncode is a String class function that converts a US-ASCII string to its representation in the URL Encoding scheme. URLEncode is based on the URL character encoding rules as described in the Internet Standards document: 

RFC 1738 - Uniform Resource Locators (URL)  

URLEncode performs special handling for characters deemed unsafe in the URL encoding scheme, and any graphical US-ASCII characters in the range 80-FF hexadecimal. The characters are converted to the character triplet consisting of the "%" character followed by the two-digit hexadecimal value for the octet. 

Use URLDecode to return a URL-encoded string to its US-ASCII representation.

      AURLString := TIdURI.URLEncode(AString);
Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.