-
-
Notifications
You must be signed in to change notification settings - Fork 545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Punycode support #552
Labels
Comments
import std/strutils
from std/sugar import collect
from std/punycode import decode
import std/uri
echo "URI to sanitize : "
var name: string = readline(stdin)
var url: Uri = parseUri(name)
var bits: seq[string] = url.hostname.split(".")
let cleaned_bits: seq[string] = sugar.collect(newSeq):
for bit in bits:
if bit.startsWith("xn--"):
decode(bit[4 .. ^1])
else:
bit
var cleaned_hostname: string = cleaned_bits.join(".")
var cleaned_url: Uri = url
cleaned_url.hostname = cleaned_hostname
echo $cleaned_url This snippet transforms punycode encoded uris to their utf8 representation. Though, I don't think it is really idiomatic and I wouldn't know how to insert it in nitter source. |
This was referenced May 19, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
RFC5891 provides a way to use internationalized domain names. Currently they are not rendered properly in nitter (see there for an example)
The text was updated successfully, but these errors were encountered: