base64decode([outputencoding])
Converts the attribute value to a Base64-decoded string. The formatter decodes the Base64 value to bytes and then returns those bytes in the encoding that outputencoding specifies.- outputencoding: The optional string that specifies the output encoding. The allowed values are
utf-8,hex,base64, or the name of another character encoding, such asiso-8859-1. The values are not case sensitive. The default isutf-8.utf-8: Returns the decoded bytes as UTF-8 text.hex: Returns the decoded bytes as an uppercase hex string.base64: Returns the decoded bytes as a Base64 string.
hex or base64 when the decoded value is binary data, such as a GUID or a hash. Bytes that are not valid UTF-8 text are corrupted if the formatter returns them as utf-8.
Example
The following example decodes a Base64 value and returns the result as a hex string.74657374.
base64encode([inputencoding])
Converts the attribute value to a Base64-encoded string. The formatter converts the value to bytes by using the encoding that inputencoding specifies and then Base64-encodes those bytes.- inputencoding: The optional string that specifies the input encoding. The allowed values are
utf-8,hex,base64, or the name of another character encoding, such asiso-8859-1. The values are not case sensitive. The default isutf-8.utf-8: Treats the value as UTF-8 text.hex: Treats the value as a hex string. The value must have an even number of characters, or the formatter fails with the error “Invalid HEX-encoded data.”base64: Treats the value as a Base64 string.
Examples
The following example Base64-encodes a hex string.dGVzdA==.
The following example generates a GUID in Base64 format. The guid(false) call returns the GUID without dashes, which makes it a valid hex string.
mIikiosjR421TscXkTXfVg==. This approach is much faster than converting each value with the encDecode operation when a script generates many GUIDs.
csvescape()
Returns CSV data from the column that matches a value with each element output as individual results.Example
In the following example, both the csv function and thecsvescape options are output from the sample CSV document.
hexdecode([outputencoding])
Converts the attribute value to a hex-decoded string. The formatter decodes the hex value to bytes and then returns those bytes in the encoding that outputencoding specifies. An empty value returns an empty result. A hex value with an odd number of characters fails with the error “Invalid HEX-encoded data.”- outputencoding: The optional string that specifies the output encoding. The allowed values are
utf-8,hex,base64, or the name of another character encoding, such asiso-8859-1. The values are not case sensitive. The default isutf-8.utf-8: Returns the decoded bytes as UTF-8 text.hex: Returns the decoded bytes as an uppercase hex string.base64: Returns the decoded bytes as a Base64 string.
Example
The following example decodes a hex value and returns the result as a Base64 string.mIikiosjR421TscXkTXfVg==.
hexencode([uppercase][, inputencoding])
Converts the attribute value to a hex-encoded string. The formatter converts the value to bytes by using the encoding that inputencoding specifies and then hex-encodes those bytes. An empty value returns an empty result.- uppercase: The optional boolean value that specifies whether to use uppercase hex characters. The default is
true. Set this value tofalseto return lowercase hex. - inputencoding: The optional string that specifies the input encoding. The allowed values are
utf-8,hex,base64, or the name of another character encoding, such asiso-8859-1. The values are not case sensitive. The default isutf-8.utf-8: Treats the value as UTF-8 text.hex: Treats the value as a hex string. The value must have an even number of characters, or the formatter fails with the error “Invalid HEX-encoded data.”base64: Treats the value as a Base64 string.
inputencoding is the second parameter, so you must also pass uppercase to use it. For example,
hexencode('base64') does not set the input encoding. The formatter reads 'base64' as the uppercase value instead. Use hexencode(false, 'base64') or hexencode(true, 'base64').Examples
The following example hex-encodes a Base64 value and returns lowercase hex.9888a48a8b23478db54ec7179135df56.
The following example hex-encodes text in the iso-8859-1 character encoding.
E9.
jsonescape()
Converts the attribute value to a JSON-escaped, single-line string.md5hash([encodetobase64][, inputencoding])
Computes the MD5 hash of the attribute value.- encodetobase64: The optional boolean value that specifies whether to convert the result into a Base64-encoded string. The default is
true. - inputencoding: The optional string that specifies the input encoding. The allowed values are
utf-8,hex,base64, or the name of another character encoding, such asiso-8859-1. The values are not case sensitive. The default isutf-8.
sha1hash([encodetobase64][, inputencoding])
Computes the SHA-1 hash of the attribute value.- encodetobase64: The optional boolean value that specifies whether to convert the result into a Base64-encoded string. The default is
true. - inputencoding: The optional string that specifies the input encoding. The allowed values are
utf-8,hex,base64, or the name of another character encoding, such asiso-8859-1. The values are not case sensitive. The default isutf-8.
sha2hash([algorithm][, encodetobase64][, inputencoding])
Computes the SHA-2 hash of the attribute value.- algorithm: The optional string that specifies the SHA-2 algorithm to use. The allowed values are
SHA-256,SHA-384, orSHA-512. The default isSHA-256. - encodetobase64: The optional boolean value that specifies whether to convert the result into a Base64-encoded string. The default is
true. - inputencoding: The optional string that specifies the input encoding. The allowed values are
utf-8,hex,base64, or the name of another character encoding, such asiso-8859-1. The values are not case sensitive. The default isutf-8.
sqlescape()
Converts the attribute value to an SQL-escaped, single-line string.- dbtype: The database type to encode. The allowed values are
SQLorSQLite. The default isSQL.