From dfb1cb42f15fa8a195ee0a35e9079ca5b14efdca Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Fri, 6 Jan 2023 01:07:37 -0800 Subject: [PATCH] Simplify 1 byte encodings Markings not required because the encoding is equal to the code point --- script.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script.js b/script.js index 5662c1a..76329b6 100644 --- a/script.js +++ b/script.js @@ -40,8 +40,9 @@ function calculateOutput(input) { function parseBytes(bytes) { // A UTF-8 encoded code point with a byte length of 1 is always encoded with this pattern: 0xxxxxxx + // Do not mark first bit insignificant because the UTF-8 encoding is exactly equal to the code point binary if (bytes.length === 1) { - return `0${bytes[0].substring(2)}`; + return `${bytes[0]}`; } // All other UTF-8 byte lengths follow the same pattern -- 2.47.3