Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

16 Commits

Repository files navigation

UTF-7

CircleCI

Encodes and decodes JavaScript (Unicode/UCS-2) strings to UTF-7 ASCII strings. It supports two modes: UTF-7 as defined in RFC 2152 and Modified UTF-7 as defined by the IMAP standard in RFC 3501, section 5.1.3

Usage

RFC 2152

varutf7=require('utf7');varencoded=utf7.encode('Jyväskylä');assert.equal('Jyv+AOQ-skyl+AOQ-',encoded);vardecoded=utf7.decode(encoded);assert.equal('Jyväskylä',decoded);

By default, .encode() only encodes the default characeters defined in RFC 2152. To also encode optional characters, use .encodeAll() or specify the characters you want to encode as the second argument to .encode().

IMAP (RFC 3501)

varutf7=require('utf7').imap;varencoded=utf7.encode('"你好" heißt "Hallo"');assert.equal('"&T2BZfQ-" hei&AN8-t "Hallo"',encoded);vardecoded=utf7.decode(encoded);assert.equal('"你好" heißt "Hallo"',decoded);

About

Converts text to and from UTF-7 (RFC 2152 and IMAP).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages