Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Add convertToString #8

thiloplanz opened this Issue · 2 comments

2 participants


I am now using iconv to convert a SJIS buffer to UTF-8 and then to a node.js String.

If I am not mistaken, the conversion to string will make another copy of the UTF-8 buffer.
(If that is not the case, please ignore this non-issue...)

The iconv module could have a convertToString function, that constructs a String directly from the internal buffer, without copying it (assuming that such an operation is possible from C land)


It wasn't when I first wrote node-iconv but V8 strings can be externalized now so this seems like a feasible (and reasonable) feature request.


Closing this as WONTFIX. Only ASCII and two byte strings can be externalized and UTF-8 is a run-length encoding.

Externalized strings also need special handling in V8's GC, making them expensive compared to regular strings. In most cases you're better off taking the initial memcpy() hit. We don't use them in node.js core, for instance.

@bnoordhuis bnoordhuis closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.