diff options
author | Tony Gorez <gorez.tony@gmail.com> | 2022-09-06 09:20:16 +0300 |
---|---|---|
committer | Juan José Arboleda <soyjuanarbol@gmail.com> | 2022-10-11 22:45:22 +0300 |
commit | 371804752a2de649d627a1d64ef1a266f632f36f (patch) | |
tree | 6c9b4de94ae62c3ba422f7ce1c096ebd335323c9 /src | |
parent | d846e5bac527a4dcca45e24cb181d6adb17c9b2f (diff) |
test: add more cases for parse-encoding
PR-URL: https://github.com/nodejs/node/pull/44427
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Qingyu Deng <i@ayase-lab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/api/encoding.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/api/encoding.cc b/src/api/encoding.cc index 68278ff7371..3ccfd6c84b7 100644 --- a/src/api/encoding.cc +++ b/src/api/encoding.cc @@ -15,6 +15,10 @@ enum encoding ParseEncoding(const char* encoding, switch (encoding[0]) { case 'u': case 'U': + // Note: the two first conditions are needed for performance reasons + // as "utf8"/"utf-8" is a common case. + // (same for other cases below) + // utf8, utf16le if (encoding[1] == 't' && encoding[2] == 'f') { // Skip `-` |