URL Encode function in ABL

D.Cook

Member
I need to encode a string to make it valid for a URL. Before I write a hundred REPLACE statements, does anyone have a sample function, or a better way?

Basically I want to replicate the behaviour of PHP's urlencode
 
This is an except from the online help (OpenEdge 10.1c), if that's what you're looking for ...

url-encode
url-encode

This function encodes characters that can be misinterpreted in a URL (for example tilde ~ or percent %) as hexidecimal triplets. For instance, %7E is the tilde character and the percent character is %25.
Location: web\method\cgiutils.i
Parameters:
INPUT p_value AS CHARACTER

  • The character expression to encode.

INPUT p_enctype AS CHARACTER

  • Either query, cookie, or default. The query option is suitable for encoding name and value pairs for use as arguments in a URL. The cookie option is suitable for encoding cookie contents. The default option is the default encoding as defined in RFC 1738, section 2.2.

Returns: CHARACTER
Notes: None
Examples: See the set-cookie function in web\method\cookies.i.
See also:

url-decode
url-format
HTH, RealHeavyDude.
 
Back
Top