diff options
author | bptato <nincsnevem662@gmail.com> | 2024-10-06 19:25:58 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-10-06 20:22:01 +0200 |
commit | c9cb63074160fd52dd061f82b9132bdc7e720d2b (patch) | |
tree | ec26ae0e3572afa5d6cf089ff2a20cd946ff6b97 /src/types/url.nim | |
parent | 7bfcef1bb2538d6fde0cf6bc589bff705207fa8e (diff) | |
download | chawan-c9cb63074160fd52dd061f82b9132bdc7e720d2b.tar.gz |
url: fix IDNA bugs
Diffstat (limited to 'src/types/url.nim')
-rw-r--r-- | src/types/url.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/types/url.nim b/src/types/url.nim index 72e817c1..756bf344 100644 --- a/src/types/url.nim +++ b/src/types/url.nim @@ -345,7 +345,7 @@ func processIdna(str: string; beStrict: bool): string = let r = unicode_general_category(addr cr, "Mark") assert r == 0 var labels = "" - for label in ($mapped).split('.'): + for label in mapped.toUTF8().split('.'): if label.startsWith("xn--"): try: let s = punycode.decode(label.substr("xn--".len)) @@ -386,7 +386,7 @@ func unicodeToAscii(s: string; beStrict: bool): string = var all = 0 for label in processed.split('.'): var s = "" - if AllChars - Ascii in s: + if AllChars - Ascii in label: try: s = "xn--" & punycode.encode(label) except PunyError: |