POD2::J...ncWords(3)

💖 NAME 💖

okay bestie, this is POD2::J...ncWords(3) from the User Contributed Perl Documentation corner 🫶 — the page for Encode::MIME::EncWords~[ja]: MIME’s “B” and “Q” header encoding, but like, the alternative option 💅.

✨ SYNOPSIS ✨

        use Encode::MIME::EncWords;
        use Encode qw/encode decode/;

        # ヘッダデコードする。
        $utf8   = decode('MIME-EncWords', $header);

        # 初期のキャラクタセット (UTF-8) でヘッダエンコードする。
        $header = encode('MIME-EncWords', $utf8);

        # ほかのキャラクタセットでヘッダエンコードする。
        Encode::MIME::EncWords->config(Charset => 'GB2312');
        $header = encode('MIME-EncWords', $utf8);

🌸 ABSTRACT 🌸

This module implements the MIME header encoding described in RFC 2047. The encoding names include three variants plus one simplified version specialized for a character set. Here’s the mapping, bestie:

  • MIME-EncWords — the encode() result: auto-detects B and Q.
  • MIME-EncWords-B — encode() result: =?XXXX?B?...?=, and the default is "UTF-8".
  • MIME-EncWords-Q — encode() result: =?XXXX?Q?...?=, same default "UTF-8" (the original table uses ,, here to mean ditto).
  • MIME-EncWords-ISO_2022_JP — encode() result: =?ISO-2022-JP?B?...?=.

And the way that decode() gives the same result no matter which of these encodings you use? iconic. periodt. 💖

🎀 DESCRIPTION 🎀

This module is intended as an alternative to the MIME-* encodings that the core module Encode::MIME::Header provides. For the full tea on how to use it, go read Encode — it’s giving required reading, iykyk. 📚

🦋 モジュール独自の機能 (module-specific features) 🦋

config(KEY => VALUE, ...); — class method. Sets options using KEY => VALUE pairs. These are the options you can use:

  • Charset — [encode] The character set used to convert data elements. Default is "UTF-8". For "MIME-EncWords-ISO_2022_JP", it’s locked to "ISO-2022-JP".
  • Detect7bit — [decode/encode] Tries to detect the 7-bit character set of the parts that aren’t encoded. Default is "YES".
  • Field — [encode] The header field name. Its length is considered on the first line of the encoded result. Default is "undef".
  • Mapping — [decode/encode] Specifies the mapping actually used for character set names. Default is "EXTENDED".
  • MaxLineLen — [encode] Maximum line length (excluding newline). Default is 76.
  • Minimal — [encode] Whether to minimize encoding. Default is "YES".

See MIME::EncWords~[ja] for details on the options.

💀 CAVEAT 💀

  • Not a magic mallet, bestie. MIME header encoding modules are not a magic mallet that can easily produce complicated header fields or easily pull the desired elements out of them. To decode address header fields (To:, From:, etc.), first split the mailbox-list. Then decode each individual element with the encoding module. To encode this, this time encode each individual element with the encoding module. Then assemble the mailbox-list from the encoded elements. For assembling or splitting mailbox-list, a module like Mail::Address could be used.
  • Line endings are a whole thing. Separate lines with LF ("\n"). RFC5322 says that internet messages separate lines with CRLF ("\r\n"). So yeah, keep that in mind fr fr.

🐛 BUGS 🐛

Please tell the developer about bugs and bug-like behavior — they wanna know, no cap.

CPAN Request Tracker: http://rt.cpan.org/Public/Dist/Display.html?Name=MIME-EncWords.

⭐ VERSION ⭐

Check the $VERSION variable. This is an experimental release — the spec might change in the near future, so don’t get too attached to the exact vibes yet. 😭

The development version of this package lives here: http://hatuka.nezumi.nu/repos/MIME-EncWords/.

🌈 SEE ALSO 🌈

  • Encode
  • Encode::MIME::Header
  • MIME::EncWords~[ja]
  • RFC 2047 MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text.

👑 AUTHOR 👑

Hatuka*nezumi - IKEDA Soji <hatuka(at)nezumi.nu>

Copyright (C) 2011 Hatuka*nezumi - IKEDA Soji.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


mwah 💋 that’s the whole page, bestie — POD2::J...ncWords(3), from perl v5.42.0, dated 2024-02-13. slay and happy header encoding 🎀✨

📦 where this page comes from