aboutsummaryrefslogtreecommitdiffstats
path: root/src/types
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-04-10 00:58:19 +0200
committerbptato <nincsnevem662@gmail.com>2024-04-10 00:58:19 +0200
commit213e6083a68c8d09e1a928ef5fa49983bc818ee1 (patch)
tree84def89cfd4999cbcac43a9178766b67bc3026f4 /src/types
parent28101d383ed2f7733af0998cc4018c64a1e94e13 (diff)
downloadchawan-213e6083a68c8d09e1a928ef5fa49983bc818ee1.tar.gz
twtstr: remove isAscii, simplify onlyWhitespace
Diffstat (limited to 'src/types')
-rw-r--r--src/types/url.nim4
1 files changed, 2 insertions, 2 deletions
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: