From eb1ec2f2318e2851073ea1634e5003cdb53f1c1b Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Sat, 17 Apr 2021 18:08:00 -0400 Subject: [PATCH] Fix Android React Native environment shims which crash on normalizing Korean test (#1298). --- packages/shims/src/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/shims/src/index.js b/packages/shims/src/index.js index 2281298d7..d0206ca38 100644 --- a/packages/shims/src/index.js +++ b/packages/shims/src/index.js @@ -12,9 +12,19 @@ var forms = ["NFD", "NFC", "NFKD", "NFKC"]; for (var i = 0; i < forms.length; i++) { try { + // Simple test that catches invalid normalization if ("test".normalize(forms[i]) !== "test") { throw new Error("failed to normalize"); } + + // Some platforms seem to only fail when normalizing + // specific code planes, so add those here as they + // come up. + // "hangul" + const checks = [ "\ud55c\uae00" ]; + for (var j = 0; j < checks.length; j++) { + checks[j].normalize(forms[i]); + } } catch(error) { missing.push(forms[i]); }