encoding_decoding_binhex
Encode text to BinHex 4.0 (HQX) format or decode a BinHex stream back to text, preserving Finder metadata like filename, type, and creator codes.
Instructions
BinHex Encoder and Decoder. Encode text to BinHex 4.0 (HQX) or decode a BinHex stream back to text. BinHex is the classic Macintosh binary-to-ASCII format that wraps a file's data fork plus Finder metadata (filename, 4-char type and creator codes) and CRC checksums into a 7-bit ":...:" envelope for email and cross-platform transfer. Use encoding_decoding_uuencode or encoding_decoding_xxencode for Unix/Usenet files, encoding_decoding_base64 for the ubiquitous web/MIME format, or encoding_decoding_ascii85 for the most compact ASCII-safe output. Runs locally on the text you provide: read-only, non-destructive, contacts no external service, and is rate-limited (60 requests/minute for anonymous callers). Returns the converted string; decoding also returns the recovered filename, type, creator, and byte size.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Input to convert: UTF-8 plaintext when encoding, or a BinHex 4.0 stream (the ":...:" block) when decoding. Must not be blank. | |
| operation | Yes | Direction: encode wraps text into a BinHex 4.0 envelope; decode recovers the original text and Finder metadata from a BinHex stream. | |
| filename | No | Encode-only: filename stored in the BinHex header (truncated to 63 bytes). Ignored when decoding (filename is read from the stream). | data.bin |
| type | No | Encode-only: 4-character Macintosh Finder file type code (padded/truncated to 4 chars). Ignored when decoding. | TEXT |
| creator | No | Encode-only: 4-character Macintosh Finder creator code (padded/truncated to 4 chars). Ignored when decoding. | UNIX |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | No | Whether the conversion succeeded. | |
| input | No | The submitted text, echoed back. | |
| operation | No | The operation performed (encode or decode). | |
| filename | No | Encode: the filename you supplied. Decode: filename recovered from the BinHex header. | |
| type | No | Encode: the type code you supplied. Decode: type code recovered from the header. | |
| creator | No | Encode: the creator code you supplied. Decode: creator code recovered from the header. | |
| size | No | Decode only: byte length of the recovered data fork. | |
| result | No | Encode: the BinHex 4.0 envelope string. Decode: the recovered file contents as text. |