dinhoabreu / codes Goto Github PK
View Code? Open in Web Editor NEWNode.js iconv bindings - Streamable, fast and lightweight
Home Page: http://dinhoabreu.github.com/codes
Node.js iconv bindings - Streamable, fast and lightweight
Home Page: http://dinhoabreu.github.com/codes
It seems that when an input string ends with a double-quote character ("), that character is not correctly converted to UTF-7. There are probably other affected characters (at a guess, all the characters outside the set of UTF-7 direct characters), but this is the one that tripped me up.
Here is a test case to demonstrate the issue:
var codes = require('codes');
var input = '"test"';
var expect = '+ACI-test+ACI'; // obtained with `echo '"test"' | iconv -f utf8 -t utf7` using iconv (Ubuntu EGLIBC 2.11.1-0ubuntu7.12) 2.11.1
//var expect = '+ACI-test+ACI-'; // obtained using node-iconv 2.0.7
var from = 'utf8';
var to = 'utf7';
var conv = codes.create(to, from);
var input_buf = new Buffer(input, from);
var output_buf = conv.convert(input_buf);
var output = output_buf.toString('ascii');
console.log(expect, input, output);
Using codes 0.2.4, the output variable ends with "+AC" when it should end with "+ACI" or "+ACI-". I experimented with the various conversion methods to see if there was a specific code path that was causing this, but even calling the C binding directly produces the same truncated result.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.