NAME
std/string/quoted_printable - Quoted-printable encoders and decoders.
SYNOPSIS
from std/string/quoted_printable import encode, decode;
let raw := to_binary( "Hello, world!\r\n" );
let text := encode(raw);
let bytes := decode(text);
let binary_text := encode(raw, binary: true);
let short_lines := encode(raw, line_length: 40, newline: "\n");
IMPLEMENTATION SUPPORT
This module is supported by all implementations of ZuzuScript.
DESCRIPTION
This module provides quoted-printable encoding and decoding helpers for RFC 2045-style byte transport. Encoding returns ASCII String text. Decoding returns a BinaryString, because quoted-printable is a byte transfer encoding rather than a Unicode text format.
The binary option controls how input line break bytes are encoded. In the default non-binary mode, CRLF, CR, and LF bytes are normalized to the configured newline string. In binary mode, CR and LF bytes are encoded as =0D and =0A.
EXPORTS
Functions
encode(BinaryString bytes, ... PairList options)Parameters:
bytesis binary input data andoptionscontrols encoding. Returns:String. Encodesbytesas quoted-printable ASCII text.decode(String text, ... PairList options)Parameters:
textis quoted-printable text andoptionscontrols strictness. Returns:BinaryString. Decodes quoted-printable text into bytes.
OPTIONS
line_lengthMaximum encoded line length. Defaults to
76and must be at least4.newlineOutput newline for hard line breaks and encoded soft breaks. Defaults to CRLF.
binaryWhen true, encode CR and LF bytes as
=0Dand=0A. Defaults to false.strictWhen true, malformed quoted-printable escape sequences throw during decoding. Non-strict decoding preserves malformed escape text literally.
COPYRIGHT AND LICENCE
std/string/quoted_printable is copyright Toby Inkster.
It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.