Fix Android React Native environment shims which crash on normalizing Korean test (#1298).

This commit is contained in:
Richard Moore 2021-04-17 18:08:00 -04:00
parent b65508995c
commit eb1ec2f231
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651

@ -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]);
}