stream-utils / raw-body

Get and validate the raw body of a readable stream

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect default encoding

felixsanz opened this issue · comments

I'm creating this issue again since you closed #50 and then locked it down, not letting me talk anymore. Sigh...

You said:

The encoding is passed to the iconv-lite module, not node.js core.

First, if you check their wiki at Supported-Encodings:

Node.js Native encodings: utf8, ucs2 / utf16le, ascii, binary, base64, hex

It's utf8, not utf-8. Basically because the encodings ARE passed to node.js after all.

Second, you can take a look at their tests to see that it's used utf8 everywhere.

Third, if it works with utf-8 it's just because its an ALIAS. All encodings are transformed with:

var enc = (''+encoding).toLowerCase().replace(/[^0-9a-z]|:\d{4}$/g, "");

Which, basically converts utf-8 into the CORRECT utf8.

So the default value of utf-8 in this library is MISLEADING because the correct ones, both in node and iconv-lite, are ------> utf8.

Since you locked the other issue, it seems that you are mad with the world or my contribution/messages are disturbing to you. So this is my last message, do whatever you want with your repo. Thanks. Happy new year.