-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken result when decoding large files #104
Comments
That's a large work, thank you so much for doing it! I'll look into it asap. |
Just tried it and I have a different |
Tried node versions 0.12.4, 0.11.13, 0.12.7, io.js v3.3.0, all worked well (too-large.html and too-large-conv.html were the same). Maybe architecture is different? Are you using x86 or x64? Can you give more info on your machine specs? |
The problem is still given, Windows 10 (updated from Windows 7), Node v0.12.7 x64. Also I tried Node versions 0.12.4, 0.11.13, both x86 and x64. Do you have any other hints to look for? |
Hmm.. All my test machines are mac/Ubuntu, so probably related to Windows. My guess is that line endings are changed somewhere on load/save file, on Can you write a function that checks line endings in Buffer-s before and Another test - can you skip conversion for 'too-large', just load - copy Third test - can you try io.js latest? They use newer version of V8 & libuv
|
A good hint to mention line-endings to cause additional trouble. However, they are just involved as they increased file-size by another character per line-break. On my Windows machine with option With an increased file-size the issue is reproducible on machines treating line-endings Unix-style. Node v0.12.7 still shows the affected behaviour. The result is correct using io.js v3.0.0 and node v4.0.0. |
Ok, so I found the problem here. The issue is a node bug and documented as node#1024. Affected Node versions: v0.11.7 - v1.4.3. Fixing commit: 1640dedb3b2 A bit more context: when decoding, iconv-lite fills out ucs2-encoded Buffer that then is converted to JS string. The linked issue prevented correct conversion at this step. The fix is to just upgrade node. Thanks for creating a reproducible test case. |
Thank you for your effort! |
With iconv-lite I encountered large files to cause problems on decoding. There aren't any thrown errors, but the decoded result is broken at least by stripped lines at the file's end.
I cut it down to a mcve: The issue is given on file
too-large.html
(507kb), whereby filelarge.html
(501kb) decodes and encodes correctly.I also added a zip-archive including the folder
node_modules
.For my project I switched to module node-iconv.
The text was updated successfully, but these errors were encountered: