doc: fix encoding string in buffer example#12482
doc: fix encoding string in buffer example#12482MapleGu wants to merge 1 commit intonodejs:masterfrom MapleGu:patch-1
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 |
addaleax
left a comment
There was a problem hiding this comment.
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 <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: #12482 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: #12482 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: #12482 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: #12482 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: #12482 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: nodejs/node#12482 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)