IDN with Gemini?

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)

---

Previous in thread (56 of 68): 🗣️ Stephane Bortzmeyer (stephane (a) sources.org)

Next in thread (58 of 68): 🗣️ Stephane Bortzmeyer (stephane (a) sources.org)

View entire thread.