DEVTOOLS: COMPANION, COMMON: Add DEL character to be punycoded

This commit is contained in:
eientei 2022-06-24 11:53:47 +12:00 committed by Eugene Sandulenko
parent 34faf7f6ea
commit fa3e3025bf
2 changed files with 3 additions and 2 deletions

View File

@ -58,7 +58,7 @@ namespace Common {
#define INITIAL_BIAS 72
#define SMAX 2147483647 // maximum Unicode code point
#define SPECIAL_SYMBOLS "/\":*|\\?%<>"
#define SPECIAL_SYMBOLS "/\":*|\\?%<>\x7f"
static uint32 adapt_bias(uint32 delta, unsigned n_points, int is_first) {
uint32 k;

View File

@ -203,7 +203,7 @@ def escape_string(s: str) -> str:
for char in s:
if char == "\x81":
new_name += "\x81\x79"
elif char in '/":*|\\?%<>' or ord(char) < 0x20:
elif char in '/":*|\\?%<>\x7f' or ord(char) < 0x20:
new_name += "\x81" + chr(0x80 + ord(char))
else:
new_name += char
@ -689,6 +689,7 @@ def test_decode_name():
],
["Buried in Timeェ Demo", "xn--Buried in Time Demo-yp97h"],
["ぱそすけPPC", "xn--PPC-873bpbxa3l"],
["Madeline Pre-K\x7f Demo", "xn--Madeline Pre-K Demo-8a06x"],
]
for input, output in checks:
assert punyencode(input) == output