-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
doc: fix encoding string in buffer example #12482
Conversation
Hi! In the write method of Buffer there is a switch for the encoding, where the different encoding are taked into account with dash and without dash. So bot utf8 and utf-8 works, ucs2 and ucs-2, utf16le and utf-16le... I think that the best solution is not to modify the documentation, but adding the latin-1 option in the "case 7" of the switch:
|
cc @nodejs/buffer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! It would be great if you could reword the commit message so that it starts with doc:
and describes what the patch itself does, e.g. doc: fix encoding string in buffer example
. If you don’t feel comfortable doing that we can also do that for you when landing the commit. :)
@jseijas I would be careful about adding another encoding alias; the ones we have right now are mostly there for historic reasons, and having to support more encoding strings comes with a certain performance impact. That we have introduced (Also, there’s quite a few more places in the codebase where such an alias would have to be supported.) |
+1 to @addaleax here... adding a new alias carries a definite non-zero cost in terms of complexity and performance for very little gain. |
The doc change is trivial enough that this shouldn't need to wait 48 hours to land |
Landed in 3bf358d. |
PR-URL: #12482 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: #12482 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: #12482 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: #12482 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: #12482 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: #12482 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: nodejs/node#12482 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)