Name

SPVM::MIME::QuotedPrint - Quoted-Printable Encoding/Decoding

Description

The MIME::QuotedPrint class of SPVM has methods for Quoted-Printable encoding/decoding.

Usage

use MIME::QuotedPrint;

my $encoded = MIME::QuotedPrint->encode_qp($decoded);
my $decoded = MIME::QuotedPrint->decode_qp($encoded);

Class Methods

encode_qp

static method encode_qp : string ($string : string, $eol : string = undef, $binmode : int = 0)

Returns an Quoted-Printable encoded version of the string $string.

The second argument $eol is the line-ending sequence to use. It is optional and defaults to \n.

Every occurrence of \n is replaced with this string, and it is also used for additional "soft line breaks" to ensure that no line end up longer than 76 characters.

Pass it as \015\012 to produce data suitable for external consumption. The string \r\n produces the same result on many platforms, but not all.

The third argument $binmode will select binary mode if passed as a TRUE value. In binary mode \n will be encoded in the same way as any other non-printable character.

This ensures that a decoder will end up with exactly the same string whatever line ending sequence it uses.

An $eol of "" (the empty string) is special. In this case, no "soft line breaks" are introduced and binary mode is effectively enabled so that any \n in the original data is encoded as well.

Exceptions:

The $string must be defined. Otherwise an exception is thrown.

decode_qp

static method decode_qp : string ($string : string);

Returns the plain text version of the Quoted-Printable string $string.

The lines of the result are \n terminated, even if the $string argument contains \r\n terminated lines.

Exceptions:

The $string must be defined. Otherwise an exception is thrown.

Distribution Containing This Class

SPVM::MIME::Base64

Other Modules in This Distribution

See Also

Author

Yuki Kimoto (kimoto.yuki@gmail.com)

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License