IDN with Gemini?
Stephane Bortzmeyer
stephane at sources.org
Tue Dec 8 10:29:24 GMT 2020
On Mon, Dec 07, 2020 at 06:00:02PM +0000,
colecmac at protonmail.com <colecmac at protonmail.com> wrote
a message of 32 lines which said:
> What parsing would a client have to do?
...
> This would then require IRI parsing libraries, and as I have explained
> earlier, these don't exist in likely many programming languages, and
> when they do, they are third-party.
For Python (a common programming language), this is not true, standard
library's urlparse has no problem:
% ./test-urlparse.py gemini://gémeaux.bortzmeyer.org:8965/café\?foo=bar
Host name: gémeaux.bortzmeyer.org
Port: 8965
Path: /café
Query: foo=bar
% cat test-urlparse.py
#!/usr/bin/env python3
import sys
import urllib.parse
for url in sys.argv[1:]:
components = urllib.parse.urlparse(url)
print("Host name: %s" % components.hostname)
if components.port is not None:
print("Port: %s" % components.port)
print("Path: %s" % components.path)
if components.query != "":
print("Query: %s" % components.query)
More information about the Gemini
mailing list