From 3e1bdd0dae6d387c7ec3ab6d800ede055814d20f Mon Sep 17 00:00:00 2001 From: Jesse Tane Date: Tue, 11 Aug 2015 00:44:05 -0400 Subject: [PATCH] replace unicode in the surrogate pair range the way node@3 does --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 623e7cf..b5f4588 100644 --- a/index.js +++ b/index.js @@ -669,7 +669,7 @@ function utf8Slice (buf, start, end) { thirdByte = buf[i + 2] if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) - if (tempCodePoint > 0x7FF) { + if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { codePoint = tempCodePoint } } -- 2.34.1