From 213e6083a68c8d09e1a928ef5fa49983bc818ee1 Mon Sep 17 00:00:00 2001 From: bptato Date: Wed, 10 Apr 2024 00:58:19 +0200 Subject: twtstr: remove isAscii, simplify onlyWhitespace --- src/types/url.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/types/url.nim') diff --git a/src/types/url.nim b/src/types/url.nim index e73d5f83..83460dc3 100644 --- a/src/types/url.nim +++ b/src/types/url.nim @@ -355,7 +355,7 @@ func unicodeToAscii(s: string, beStrict: bool): Option[string] = var labels: seq[string] var all = 0 for label in processed.get.split('.'): - if not label.isAscii(): + if AllChars - Ascii in s: try: let converted = "xn--" & punycode.encode(label) labels.add(converted) @@ -376,7 +376,7 @@ func unicodeToAscii(s: string, beStrict: bool): Option[string] = func domainToAscii(domain: string, bestrict = false): Option[string] = var needsprocessing = false for s in domain.split('.'): - if s.startsWith("xn--") or not s.isAscii(): + if s.startsWith("xn--") or AllChars - Ascii in s: needsprocessing = true break if bestrict or needsprocessing: -- cgit 1.4.1-2-gfad0