diff options
author | Tony Gorez <gorez.tony@gmail.com> | 2022-09-06 09:20:16 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-06 09:20:16 +0300 |
commit | 112a231fab6f2634fe7ed087f48e8e4fce6c7a3e (patch) | |
tree | 48f22592ec93860399f0eaa5aec414860c91b33c /src | |
parent | 1f54fc25cb47f613235b45f29759aa7686d03178 (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 `-` |