Mangling: support for special encoding ASCII of characters which may not appear in symbol names.

Such characters (like ‘.’) can be punycode-encoded just like non-ASCII unicode characters.
This commit is contained in:
Erik Eckstein
2016-12-02 12:49:19 -08:00
parent 97f1fac11e
commit 76820edda9
3 changed files with 33 additions and 6 deletions

View File

@@ -47,7 +47,9 @@ static int digit_index(char value) {
}
static bool isValidUnicodeScalar(uint32_t S) {
return (S < 0xD800) || (S >= 0xE000 && S <= 0x1FFFFF);
// Also accept the range of 0xD800 - 0xD880, which is used for non-symbol
// ASCII characters.
return (S < 0xD880) || (S >= 0xE000 && S <= 0x1FFFFF);
}
// Section 6.1: Bias adaptation function
@@ -200,6 +202,8 @@ static bool encodeToUTF8(const std::vector<uint32_t> &Scalars,
OutUTF8.clear();
return false;
}
if (S >= 0xD800 && S < 0xD880)
S -= 0xD800;
unsigned Bytes = 0;
if (S < 0x80)