Skip to content
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

[Bug] Buffer doesn't support usc-2, but Buffer.isEncoding supports that?! #21963

Closed
ghost opened this issue Jul 25, 2018 · 6 comments
Closed
Labels
buffer Issues and PRs related to the buffer subsystem.

Comments

@ghost
Copy link

ghost commented Jul 25, 2018

Nodejs:10.7.0
OS:Win 8.1 (SP1, x32)

If you use Buffer.isEncoding('usc-2'), this will return you true.

However, most of Buffer methods are NOT supporting this encoding. A typical example is (either of them will throw exceptions):

const c = new Buffer('aaa','usc-2');
const c = Buffer.from('aaa','usc-2');

Is there anything conflicting with the encoding type?

@ghost ghost changed the title Buffer doesn't support usc-2, but Buffer.isEncoding supports that?! [Bug] Buffer doesn't support usc-2, but Buffer.isEncoding supports that?! Jul 25, 2018
@ghost
Copy link
Author

ghost commented Jul 25, 2018

@nodejs/buffer

@devsnek
Copy link
Member

devsnek commented Jul 25, 2018

what is usc-2? is that a misspelling of UCS-2?

@ghost
Copy link
Author

ghost commented Jul 25, 2018

@devsnek:Not sure why we have this encoding?

Now check this following in 10.7.0:
run

And should I help you to remove that in internal\util's normalizeEncoding?
source

Waiting for your response :)

@devsnek devsnek added the buffer Issues and PRs related to the buffer subsystem. label Jul 25, 2018
@devsnek
Copy link
Member

devsnek commented Jul 25, 2018

it was introduced in 341770f by @BridgeAR

@ghost ghost mentioned this issue Jul 25, 2018
4 tasks
@ghost
Copy link
Author

ghost commented Jul 25, 2018

@mscdex :thanks anyway!
I've also removed benchmark tests for usc-2.

mscdex added a commit to mscdex/io.js that referenced this issue Jul 25, 2018
@Trott
Copy link
Member

Trott commented Jul 25, 2018

/ping @addaleax @joyeecheung

targos pushed a commit that referenced this issue Jul 31, 2018
Fixes: #21963
PR-URL: #21964
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buffer Issues and PRs related to the buffer subsystem.
Projects
None yet
Development

No branches or pull requests

2 participants