binaryEncode

Converts binary data to a string.

binaryEncode(binaryData, encoding) → returns string

Argument Reference

binaryData binary
Required

A string containing encoded binary data.

encoding string
Required

A string specifying the encoding method to use to represent
the data; one of the following:
- hex: use characters 0-9 and A-F represent the hexadecimal value
of each byte; for example, 3A.
- UU: use the UNIX UUencode algorithm to convert the data.
- base64: use the Base64 algorithm to convert the data.
- base64URL: modification of the main Base64 standard, which uses the encoding result as filename or URL address.
Values:
  • hex
  • uu
  • base64
  • base64URL

Examples
Sample code invoking the binaryEncode function

use binaryEncode to Encode with hex

s = binaryDecode('737472696E67','hex');
 binaryEncode(s,'hex');

Expected Result: 737472696E67

use binaryEncode to Encode with UNIX UUencode (UU)

s = binaryDecode('&<W1R:6YG','UU');
 binaryEncode(s,'UU');

Expected Result: string

use binaryEncode to Encode with base64

s = binaryDecode('&<W1R:6YG','base64');
 binaryEncode(s,'base64');

Expected Result: string

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub