Comments (12)
This seems to be fixed by this patch: https://gist.github.com/896558
from node-iconv.
Hmm, I was a bit quick there, only some of the problem went away. The output is now:
+AO +AO +AO
but a final 'c' is missing.
from node-iconv.
There's similar, yet subtly different breakage the other way around:
var converter = new (require('iconv')).Iconv('utf-7', 'utf-8'),
utf7cedilla = new Buffer([0x2b, 0x41, 0x4f, 0x63]); // "+AOc" in ASCII
converter.convert(utf7cedilla).toString(); // 'ç'
converter.convert(utf7cedilla).toString(); // EINVAL, Incomplete character sequence.
converter.convert(utf7cedilla).toString(); // 'ç'
converter.convert(utf7cedilla).toString(); // EINVAL, Incomplete character sequence.
// etc.
from node-iconv.
I wrote a test case in plain C that exhibits the same behaviour so it seems you've uncovered a bug in libiconv.
I'm trying to check it against the bleeding edge but it's proving exceedingly difficult to build, one of the in-tree build tools dies with a buffer overrun if FORTIFY_SOURCE is enabled.
To be continued.
from node-iconv.
I guess one could argue that this is a bug with libiconv since the
last parameter (outbufsize) to iconv() is not updated correctly.
Still
echo -n 'ç' | ./iconv_no_i18n -f 'UTF-8' -t 'UTF-7'
Does the right thing because outbufsize is not used to determine
the size of output in iconv.c. Instead the difference between the two
pointers is used to fwrite() the correct amount of bytes (iconv.c line 707).
In node-iconv the difference between these is not correct for this example. I think the reason may be that iconvctl is used to set some hooks in iconv.c,
specifically the update_line_column seems to be called....
Now I need to get some sleep :-)
from node-iconv.
Ups, accidentally closed the issue but it seems it cannot be reopened, hmm,...
from node-iconv.
No problem, I've reopened it.
from node-iconv.
My bad, it turns out that this is indeed a bug in node-iconv: the trailer isn't written correctly. I'll try to push out a fix tomorrow.
from node-iconv.
Fixed in commit 58764b2.
Can I have one or more 'works for me too', please? :-)
from node-iconv.
WFM, too :)
from node-iconv.
Cool, thanks. I've uploaded 1.0.1 to npm just now.
from node-iconv.
Cool, thanks for the quick update :-)
from node-iconv.
Related Issues (20)
- npm install sqlite3 HOT 1
- cannot open shared object file HOT 2
- What about CHANGELOG.md HOT 5
- utf-8 to iso-8859-1 error no conversion HOT 2
- Fails to install on windows machine HOT 3
- Unable to install
- Unable to install HOT 3
- iconv cannot be used in worker threads HOT 5
- how to change "한글" to euc-kr ? HOT 1
- Can't resolve ~~ error while developing an Electron app HOT 1
- Memory leak when used with byline? HOT 2
- Upgrade node-gyp to remove python2 dependency HOT 1
- Can't convert string from ISO-8859-1 to windows-1251 HOT 3
- Encodings not supported HOT 2
- Any barriers to IBM500, 037 ? HOT 1
- not doing proper encoding HOT 5
- npm ERR! HOT 1
- WSL npm install iconv failing HOT 3
- will it work with nodejs 20? HOT 1
- NV21 failure? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-iconv.