buffer,string_decoder: consolidate encoding validation logic
Checklist
-
make -j4 test
(UNIX) orvcbuild test nosign
(Windows) passes -
documentation is changed or added -
the commit message follows commit guidelines
Affected core subsystem(s)
buffer, string_decoder
Description of change
Buffer.isEncoding and string_decoder.normalizeEncoding shared quite a bit of logic. This moves the primary logic into internal/util. The userland modules that monkey patch Buffer.isEncoding should still work.
@nodejs/buffer @mscdex