Permalink
Browse files

Test in Node.js v0.12, io.js, and Rhino 1.7R5

  • Loading branch information...
mathiasbynens committed Feb 24, 2015
1 parent 6b3e58d commit 8c9fa99c1a7d7b3f1ef9da2ac027f55debd335e5
Showing with 28 additions and 39 deletions.
  1. +4 −2 .travis.yml
  2. +0 −3 Gruntfile.js
  3. +1 −1 LICENSE-MIT.txt
  4. +6 −9 README.md
  5. +1 −1 bin/q
  6. +2 −2 man/q.1
  7. +4 −11 package.json
  8. +4 −4 q.js
  9. +2 −2 scripts/export-data.js
  10. +4 −4 src/q.js
@@ -1,13 +1,15 @@
language: node_js
node_js:
- "0.10"
- "0.12"
- "iojs"
before_script:
- "npm install -g grunt-cli"
# Narwhal uses a hardcoded path to openjdk v6, so use that version
- "sudo apt-get update -qq"
- "sudo apt-get install -qq openjdk-6-jre"
- "PACKAGE=rhino1_7R3; wget http://ftp.mozilla.org/pub/mozilla.org/js/$PACKAGE.zip && sudo unzip $PACKAGE -d /opt/ && rm $PACKAGE.zip"
- "PACKAGE=rhino1_7R3; echo -e '#!/bin/sh\\njava -jar /opt/'$PACKAGE'/js.jar $@' | sudo tee /usr/local/bin/rhino && sudo chmod +x /usr/local/bin/rhino"
- "PACKAGE=rhino1_7R5; wget https://github.com/mozilla/rhino/releases/download/Rhino1_7R5_RELEASE/$PACKAGE.zip && sudo unzip $PACKAGE -d /opt/ && rm $PACKAGE.zip"
- "PACKAGE=rhino1_7R5; echo -e '#!/bin/sh\\njava -jar /opt/'$PACKAGE'/js.jar $@' | sudo tee /usr/local/bin/rhino && sudo chmod +x /usr/local/bin/rhino"
- "PACKAGE=ringojs-0.9; wget http://ringojs.org/downloads/$PACKAGE.zip && sudo unzip $PACKAGE -d /opt/ && rm $PACKAGE.zip"
- "PACKAGE=ringojs-0.9; sudo ln -s /opt/$PACKAGE/bin/ringo /usr/local/bin/ringo && sudo chmod +x /usr/local/bin/ringo"
- "PACKAGE=v0.3.2; wget https://github.com/280north/narwhal/archive/$PACKAGE.zip && sudo unzip $PACKAGE -d /opt/ && rm $PACKAGE.zip"
@@ -16,9 +16,6 @@ module.exports = function(grunt) {
'test-phantomjs': {
'command': 'echo "Testing in PhantomJS..."; phantomjs "tests/tests.js"'
},
// Rhino 1.7R4 has a bug that makes it impossible to test in.
// https://bugzilla.mozilla.org/show_bug.cgi?id=775566
// To test, use Rhino 1.7R3, or wait (heh) for the 1.7R5 release.
'test-rhino': {
'command': 'echo "Testing in Rhino..."; rhino -opt -1 "tests.js"',
'options': {
@@ -1,4 +1,4 @@
Copyright Mathias Bynens <http://mathiasbynens.be/>
Copyright Mathias Bynens <https://mathiasbynens.be/>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -1,10 +1,10 @@
# q-encoding [![Build status](https://travis-ci.org/mathiasbynens/q-encoding.svg?branch=master)](https://travis-ci.org/mathiasbynens/q-encoding) [![Dependency status](https://gemnasium.com/mathiasbynens/q-encoding.svg)](https://gemnasium.com/mathiasbynens/q-encoding)

_q-encoding_ is a character encoding–agnostic JavaScript implementation of [the `Q` encoding as defined by RFC 2047](http://tools.ietf.org/html/rfc2047#section-4.2). It can be used to encode data with any character encoding to its `Q`-encoded form, or the other way around (i.e. decoding).
_q-encoding_ is a character encoding–agnostic JavaScript implementation of [the `Q` encoding as defined by RFC 2047](https://tools.ietf.org/html/rfc2047#section-4.2). It can be used to encode data with any character encoding to its `Q`-encoded form, or the other way around (i.e. decoding).

## Installation

Via [npm](http://npmjs.org/):
Via [npm](https://www.npmjs.com/):

```bash
npm install q-encoding
@@ -28,7 +28,7 @@ In a browser:
<script src="q.js"></script>
```

In [Narwhal](http://narwhaljs.org/), [Node.js](http://nodejs.org/), and [RingoJS](http://ringojs.org/):
In [Narwhal](http://narwhaljs.org/), [Node.js](https://nodejs.org/), and [RingoJS](http://ringojs.org/):

```js
var q = require('q-encoding');
@@ -90,9 +90,6 @@ utf8.decode(q.decode('I=C3=B1t=C3=ABrn=C3=A2ti=C3=B4n=C3=A0liz=C3=A6ti=C3=B8n=E2
// → 'Iñtërnâtiônàlizætiøn☃💩'
```




### Using the `q` binary

To use the `q` binary in your shell, simply install _q-encoding_ globally using npm:
@@ -120,7 +117,7 @@ $ q --encode < foo.txt > foo-q.txt
Or do the same with an online text file:

```bash
$ curl -sL 'http://mths.be/brh' | q --encode > q.txt
$ curl -sL 'https://mths.be/brh' | q --encode > q.txt
```

Or, the opposite — read a local file containing a `Quoted-Printable`-encoded message, decode it back to plain text, and save the result to a new file:
@@ -147,8 +144,8 @@ To generate the code coverage report, use `grunt cover`.

| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |
|---|
| [Mathias Bynens](http://mathiasbynens.be/) |
| [Mathias Bynens](https://mathiasbynens.be/) |

## License

_q-encoding_ is available under the [MIT](http://mths.be/mit) license.
_q-encoding_ is available under the [MIT](https://mths.be/mit) license.
2 bin/q
@@ -18,7 +18,7 @@

if (/^(?:-h|--help|undefined)$/.test(option)) {
log(
'q v%s - http://mths.be/q',
'q v%s - https://mths.be/q',
q.version
);
log([
@@ -53,6 +53,6 @@ Print the encoded version of the string that gets piped in.
.Sh BUGS
q's bug tracker is located at <https://github.com/mathiasbynens/q-encoding/issues>.
.Sh AUTHOR
Mathias Bynens <http://mathiasbynens.be/>
Mathias Bynens <https://mathiasbynens.be/>
.Sh WWW
<http://mths.be/q>
<https://mths.be/q>
@@ -2,7 +2,7 @@
"name": "q-encoding",
"version": "0.1.1",
"description": "A robust & character encoding–agnostic JavaScript implementation of the `Q` encoding as defined by RFC 2047.",
"homepage": "http://mths.be/q",
"homepage": "https://mths.be/q",
"main": "q.js",
"bin": {
"q": "bin/q"
@@ -18,23 +18,16 @@
"q-encoding",
"string"
],
"licenses": [
{
"type": "MIT",
"url": "http://mths.be/mit"
}
],
"license": "MIT",
"author": {
"name": "Mathias Bynens",
"url": "http://mathiasbynens.be/"
"url": "https://mathiasbynens.be/"
},
"repository": {
"type": "git",
"url": "https://github.com/mathiasbynens/q-encoding.git"
},
"bugs": {
"url": "https://github.com/mathiasbynens/q-encoding/issues"
},
"bugs": "https://github.com/mathiasbynens/q-encoding/issues",
"files": [
"LICENSE-MIT.txt",
"q.js",
8 q.js
@@ -1,4 +1,4 @@
/*! http://mths.be/q v0.1.1 by @mathias | MIT license */
/*! https://mths.be/q v0.1.1 by @mathias | MIT license */
;(function(root) {

// Detect free variables `exports`.
@@ -17,17 +17,17 @@

/*--------------------------------------------------------------------------*/

// http://tools.ietf.org/html/rfc2047#section-4.2
// https://tools.ietf.org/html/rfc2047#section-4.2
var stringFromCharCode = String.fromCharCode;
var decode = function(input) {
return input
// Decode `_` into a space. This is character-encoding-independent;
// see http://tools.ietf.org/html/rfc2047#section-4.2, item 2.
// see https://tools.ietf.org/html/rfc2047#section-4.2, item 2.
.replace(/_/g, ' ')
// Decode escape sequences of the form `=XX` where `XX` is any
// combination of two hexidecimal digits. For optimal compatibility,
// lowercase hexadecimal digits are supported as well. See
// http://tools.ietf.org/html/rfc2045#section-6.7, note 1.
// https://tools.ietf.org/html/rfc2045#section-6.7, note 1.
.replace(/=([a-fA-F0-9]{2})/g, function($0, $1) {
var codePoint = parseInt($1, 16);
return stringFromCharCode(codePoint);
@@ -2,7 +2,7 @@ var fs = require('fs');
var regenerate = require('regenerate');

// Let’s start with the safe/unsafe symbols in `Quoted-Printable` encoding.
// http://tools.ietf.org/html/rfc2045#section-6.7
// https://tools.ietf.org/html/rfc2045#section-6.7
// safe-char := <any octet with decimal value of 33 through
// 60 inclusive, and 62 through 126>
// ; Characters not listed as "mail-safe" in
@@ -22,7 +22,7 @@ var definitelyUnsafeSymbols = regenerate()
.addRange(0x0, 0x10FFFF)
.remove(safeSymbols)
.remove(' '); // Note: space is excluded because it’s special-cased.
// http://mathiasbynens.be/notes/javascript-encoding#surrogate-pairs
// https://mathiasbynens.be/notes/javascript-encoding#surrogate-pairs

module.exports = {
'unsafeSymbols': definitelyUnsafeSymbols.toString(),
@@ -1,4 +1,4 @@
/*! http://mths.be/q v<%= version %> by @mathias | MIT license */
/*! https://mths.be/q v<%= version %> by @mathias | MIT license */
;(function(root) {

// Detect free variables `exports`.
@@ -17,17 +17,17 @@

/*--------------------------------------------------------------------------*/

// http://tools.ietf.org/html/rfc2047#section-4.2
// https://tools.ietf.org/html/rfc2047#section-4.2
var stringFromCharCode = String.fromCharCode;
var decode = function(input) {
return input
// Decode `_` into a space. This is character-encoding-independent;
// see http://tools.ietf.org/html/rfc2047#section-4.2, item 2.
// see https://tools.ietf.org/html/rfc2047#section-4.2, item 2.
.replace(/_/g, ' ')
// Decode escape sequences of the form `=XX` where `XX` is any
// combination of two hexidecimal digits. For optimal compatibility,
// lowercase hexadecimal digits are supported as well. See
// http://tools.ietf.org/html/rfc2045#section-6.7, note 1.
// https://tools.ietf.org/html/rfc2045#section-6.7, note 1.
.replace(/=([a-fA-F0-9]{2})/g, function($0, $1) {
var codePoint = parseInt($1, 16);
return stringFromCharCode(codePoint);

0 comments on commit 8c9fa99

Please sign in to comment.