Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  UNICODE::IMAPUTF7 (3)

.ds Aq ’


Unicode::IMAPUtf7 - Perl extension to deal with IMAP UTF7



  use Unicode::IMAPUtf7;

  my $t = Unicode::IMAPUtf7->new();
  print $t->encode(Re\k:'\h |\n:upertoire);
  print $t->decode(R&AOk-pertoire);


  print Unicode::IMAPUtf7::imap_utf7_encode(RXpertoire);
  print Unicode::IMAPUtf7::imap_utf7_decode(R&AOk-pertoire);



IMAP mailbox names are encoded in a modified UTF7 when names contains international characters outside of the printable ASCII range. The modified UTF-7 encoding is defined in RFC2060 (section 5.1.3).


new() Returns a new instance of a Unicode::IMAPUtf7 object.
encode($text) Returns the modified UTF7-text for a string in UTF8.
decode($text) Returns the decoded string into UTF8 data.


<B>imap_utf7_encodeB>: returns the modified UTF7-text for a string in Latin1.

<B>imap_utf7_decodeB>: returns the decoded string into Latin1 data.

These functions may disappear in some later version. Please update with the new OO and UTF8 scheme. See Unicode::String for conversion functions between Latin1 and UTF8.

RFC2060 - section 5.1.3 - Mailbox International Naming Convention

By convention, international mailbox names are specified using a modified version of the UTF-7 encoding described in [UTF-7]. The purpose of these modifications is to correct the following problems with UTF-7:

1) UTF-7 uses the + character for shifting; this conflicts with
the common use of + in mailbox names, in particular USENET
newsgroup names.

2) UTF-7’s encoding is BASE64 which uses the / character; this
conflicts with the use of / as a popular hierarchy delimiter.

3) UTF-7 prohibits the unencoded usage of \; this conflicts with
the use of \ as a popular hierarchy delimiter.

4) UTF-7 prohibits the unencoded usage of ~; this conflicts with
the use of ~ in some servers as a home directory indicator.

5) UTF-7 permits multiple alternate forms to represent the same
string; in particular, printable US-ASCII chararacters can be
represented in encoded form.

In modified UTF-7, printable US-ASCII characters except for & represent themselves; that is, characters with octet values 0x20-0x25 and 0x27-0x7e. The character & (0x26) is represented by the two- octet sequence &-.

All other characters (octet values 0x00-0x1f, 0x7f-0xff, and all Unicode 16-bit octets) are represented in modified BASE64, with a further modification from [UTF-7] that , is used instead of /. Modified BASE64 MUST NOT be used to represent any printing US-ASCII character which can represent itself.

& is used to shift to modified BASE64 and - to shift back to US- ASCII. All names start in US-ASCII, and MUST end in US-ASCII (that is, a name that ends with a Unicode 16-bit octet MUST end with a - ).

For example, here is a mailbox name which mixes English, Japanese, and Chinese text: ~peter/mail/&ZeVnLIqe-/&U,BTFw-


Please report any requests, suggestions or bugs via the RT bug-tracking system at or email to bug-Unicode-IMAPUtf7\ is the RT queue for Unicode::IMAPUtf7. Please check to see if your bug has already been reported.


Copyright 2001-2004

Fabien Potencier,

This software may be freely copied and distributed under the same terms and conditions as Perl.


perl(1), Unicode::String.


Hey! <B>The above document had some coding errors, which are explained below:B>
Around line 12: Non-ASCII character seen before =encoding in ’$t->encode(’Re\k:'Assuming UTF-8
Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 UNICODE::IMAPUTF7 (3) 2004-08-29

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.