utf7
Converts text to and from UTF-7 (RFC 2152 and IMAP)
Last updated 10 years ago by kkaefer .
BSD · Original npm · Tarball · package.json
$ cnpm install utf7 
SYNC missed versions from official npm registry.

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

var utf7 = require('utf7');

var encoded = utf7.encode('Jyväskylä');
assert.equal('Jyv+AOQ-skyl+AOQ-', encoded);

var decoded = 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)

var utf7 = require('utf7').imap;

var encoded = utf7.encode('"你好" heißt "Hallo"');
assert.equal('"&T2BZfQ-" hei&AN8-t "Hallo"', encoded);

var decoded = utf7.decode(encoded);
assert.equal('"你好" heißt "Hallo"', decoded);

Current Tags

  • 1.0.2                                ...           latest (10 years ago)

3 Versions

  • 1.0.2                                ...           10 years ago
  • 1.0.1                                ...           10 years ago
  • 1.0.0                                ...           15 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 3
Last Month 3
Dependencies (1)
Dev Dependencies (1)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |