Skip to content

Commit eb1ec2f

Browse files
committed
Fix Android React Native environment shims which crash on normalizing Korean test (ethers-io#1298).
1 parent b655089 commit eb1ec2f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/shims/src/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,19 @@
1212
var forms = ["NFD", "NFC", "NFKD", "NFKC"];
1313
for (var i = 0; i < forms.length; i++) {
1414
try {
15+
// Simple test that catches invalid normalization
1516
if ("test".normalize(forms[i]) !== "test") {
1617
throw new Error("failed to normalize");
1718
}
19+
20+
// Some platforms seem to only fail when normalizing
21+
// specific code planes, so add those here as they
22+
// come up.
23+
// "hangul"
24+
const checks = [ "\ud55c\uae00" ];
25+
for (var j = 0; j < checks.length; j++) {
26+
checks[j].normalize(forms[i]);
27+
}
1828
} catch(error) {
1929
missing.push(forms[i]);
2030
}

0 commit comments

Comments
 (0)