From: Linus Unnebäck Date: Fri, 14 Aug 2015 20:29:44 +0000 (+0200) Subject: adhere to padded-blocks X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=98520589d3483748b29014871d96263d6b9aadde;p=buffer.git adhere to padded-blocks --- diff --git a/index.js b/index.js index c1b0419..86ef1a3 100644 --- a/index.js +++ b/index.js @@ -1419,7 +1419,6 @@ function utf8ToBytes (string, units) { // unexpected trail if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) continue - } else if (i + 1 === length) { // unpaired lead if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) @@ -1441,7 +1440,6 @@ function utf8ToBytes (string, units) { // valid surrogate pair codePoint = leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00 | 0x10000 - } else if (leadSurrogate) { // valid bmp char, but last char was a lead if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)