Arbortext Command Language > Functions by Alphabetical Listing > filename_encode
  
filename_encode
filename_encode (name[, escape[, translateSlash]])
This function returns the string name encoded according to internet RFC 1738. Most non-printable characters in name, including all characters with ASCII values over 255, are encoded as 2 or 4 digit hexadecimal sequences following an escape character.
This function has the following parameters:
name — The character string to encode.
escape — Optional. Specifies the character to note the start of the hexadecimal representation of an encoded character. If escape is omitted or specified as the empty string, filename_encode uses the % (percent) character. If escape contains more than one character, only the first character is used.
translateSlash — Optional. If translateSlash has any value other than 0 or "" (the null string), backslash (Windows) separators (\) are converted to forward slashes (/) and forward slashes are not encoded. If the parameter is omitted, or has a value of either 0 or the null string, backslashes are not converted to forward slashes, and both backslash and slash characters are encoded.
For example:
filename_encode('a\b/c','_',0) returns a_5Cb_2Fc
filename_encode('a\b/c','_',1) returns a/b/c
translateSlash can only be specified when escape is also specified.
The calls:
filename_encode("abc def");
filename_encode("abc def", "");
filename_encode("abc def", "%");
filename_encode("abc def", "%XYZ");
Return:
abc%20def
The call:
filename_encode("abc def", "_")
Returns:
abc_20def
The call:
filename_encode( "abc def\", "%", 1)
Returns:
abc%20def/