https://github.com/one-com/rfc2231
Encode and decode rfc2231/rfc5987
https://github.com/one-com/rfc2231
Last synced: 4 months ago
JSON representation
Encode and decode rfc2231/rfc5987
- Host: GitHub
- URL: https://github.com/one-com/rfc2231
- Owner: One-com
- Created: 2015-01-08T21:14:59.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2021-10-20T09:54:44.000Z (over 4 years ago)
- Last Synced: 2025-03-28T00:44:57.902Z (about 1 year ago)
- Language: JavaScript
- Size: 17.6 KB
- Stars: 3
- Watchers: 15
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
rfc2231
=======
Encode and decode [rfc2231](https://www.ietf.org/rfc/rfc2231.txt) (MIME Parameter Value and Encoded Word Extensions: Character Sets, Languages, and Continuations) and [rfc5987](https://www.ietf.org/rfc/rfc5987.txt) (Character Set and Language Encoding for Hypertext Transfer Protocol (HTTP) Header Field Parameters).
```js
var rfc2231 = require('rfc2231');
console.log(rfc2231.unfoldAndDecodeParameters({
'title*0*': "us-ascii'en'This%20is%20even%20more%20",
'title*1*': '%2A%2A%2Afun%2A%2A%2A%20',
'title*2': "is it not?"
}));
// {title: "This is even more ***fun*** is it not?"}
console.log(rfc2231.encodeAndFoldParameters({
foo: '0123456789012345678901234567890123456789012345678901234567890123456789'
}));
// {
// 'foo*0': '"012345678901234567890123456789012345678901234567890123456789"',
// 'foo*1': '"0123456789"'
// }
```
`rfc2231.unfoldAndDecodeParameters` takes advantage of the `iconv` module if available, and otherwise falls back to `iconv-lite`.
[](http://badge.fury.io/js/rfc2231)
[](https://travis-ci.org/One-com/rfc2231)
[](https://coveralls.io/r/One-com/rfc2231)
[](https://david-dm.org/One-com/rfc2231)