9 Header Field Encoding
(require net/unihead) | package: net-lib |
The net/unihead module
provides utilities for encoding and decoding header fields using the
=?‹encoding›?‹transport›?...?= format.
procedure
(encode-for-header s) → string?
s : string?
Encodes s for use in a header.
If s contains only ASCII characters, then the result string will have the same content as the given string. If s contains only Latin-1 characters, then on each CRLF-delimited line, the space-delimited sequence containing all non-ASCII characters in s is encoded with a =?ISO-8859-1?Q?...?= sequence. If s contains non-Latin-1 characters, then on each CRLF-delimited line, a space-delimited sequence containing all non-ASCII characters in s is encoded with a =?UTF-8?B?...?= sequence.
Examples: | ||||||||
|
procedure
(decode-for-header s) → string?
s : string?
Decodes header fields that use the =?‹encoding›?‹transport›?...?= encoding format. The
specified ‹encoding› is generalized via
generalize-encoding before decoding content.
Examples: | ||||
|
Generalizes the encoding name s to compensate for typical
mailer bugs: Latin-1 and ASCII encodings are geenralized to
WINDOWS-1252; GB and GB2312 are generalized to GBK; and KS_C_5601-1987
is generalized to CP949.