# perldoc > Encode::Unicode::UTF7

---
type: CommandReference
command: Encode::Unicode::UTF7
mode: perldoc
section: ""
source: perldoc
---

## Quick Reference
- `$utf7 = encode("UTF-7", $utf8);` — Encode a Perl UTF-8 string to UTF-7
- `$utf8 = decode("UTF-7", $ucs2);` — Decode a UTF-7 string back to a Perl string

## Name
Encode::Unicode::UTF7 — UTF-7 encoding

## Synopsis
perl
use Encode qw/encode decode/;
$utf7 = encode("UTF-7", $utf8);
$utf8 = decode("UTF-7", $ucs2);
## Description
This module implements UTF-7 encoding as documented in [RFC 2152](http://www.ietf.org/rfc/rfc2152.txt). UTF-7 is a 7‑bit re‑encoded version of UTF‑16BE, designed to be MTA‑safe for mail exchange. It was added to Encode (since version 1.95) to supersede [Unicode::String](http://localhost/phpMan.php/perldoc/Unicode%3A%3AString/markdown), which previously provided UTF‑7 support for non‑UTF‑8‑aware Perl.

## Usage Notes
Do **not** use UTF‑7 for general mail or web page encoding unless you are certain the recipients can handle it. Very few MUAs and browsers support it. Prefer UTF‑8 for message bodies and MIME headers for header encoding.

## See Also
- [Encode](http://localhost/phpMan.php/perldoc/Encode/markdown)
- [Encode::Unicode](http://localhost/phpMan.php/perldoc/Encode%3A%3AUnicode/markdown)
- [Unicode::String](http://localhost/phpMan.php/perldoc/Unicode%3A%3AString/markdown)
- [RFC 2152](http://www.ietf.org/rfc/rfc2152.txt)