From e3debcc5e18a56bba845185ef61d1657ecc4751d Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Fri, 23 Nov 2018 21:32:57 -0800 Subject: [PATCH] =?UTF-8?q?fix(emoji):=20fix=20=E2=84=A2=C2=AE=20character?= =?UTF-8?q?s=20treated=20as=20emoji=20(#682)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes #679 --- routes/_utils/replaceEmoji.js | 2 +- tests/unit/test-emoji.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/routes/_utils/replaceEmoji.js b/routes/_utils/replaceEmoji.js index b27f3c0..1abdf42 100644 --- a/routes/_utils/replaceEmoji.js +++ b/routes/_utils/replaceEmoji.js @@ -9,7 +9,7 @@ export function replaceEmoji (string, replacer) { function safeReplacer (substring) { // emoji regex matches digits and pound sign https://git.io/fpl6J - if (substring.match(/^[0-9#*]+$/)) { + if (substring.match(/^[0-9#*™®]+$/)) { return substring } return replacer(substring) diff --git a/tests/unit/test-emoji.js b/tests/unit/test-emoji.js index d827120..8da04b2 100644 --- a/tests/unit/test-emoji.js +++ b/tests/unit/test-emoji.js @@ -67,8 +67,8 @@ describe('test-emoji.js', function () { `it's over #9000` ) assert.strictEqual( - replaceEmoji(`woot !@#$%^&*()~` + '`' + `{[}]:;"'<,>.?/£`, replacer), - `woot !@#$%^&*()~` + '`' + `{[}]:;"'<,>.?/£` + replaceEmoji(`woot !@#$%^&*()~` + '`' + `{[}]:;"'<,>.?/£™℠®`, replacer), + `woot !@#$%^&*()~` + '`' + `{[}]:;"'<,>.?/£™℠®` ) })