Git Product home page Git Product logo

codes's People

Contributors

dinhoabreu avatar mscdex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

test-max

codes's Issues

truncated UTF-7 when last character is encoded as multiple octets

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.