[spec] IRIs, IDNs, and all that international jazz



> On Dec 27, 2020, at 02:19, Sean Conner <sean at conman.org> wrote:
> 
>  I meant:  If I gave your URL parsers the string
> 
> 	Research/A%2fB%20Testing/Results
> 
> what would I, as a user, get back?  Would I get a string back?  An array of
> segments?  An actual example would be be nice.

Ultimately, a list of path segments, yes. Similar to your first (correct) 
example. With both an absolute and directory indicator.

In the case above, 3 segments. Not absolute, not a directory. These 
segments are then decoded to whatever string they represents, i.e. 
segment[ 2 ] would contain the string "A/B Testing". As originally 
provided. The URL can always round trip. If not, something is very wrong.

The same problematic applies, to, say, representing an URL in an URL.

So, given the following path segments, "cache", "gemini://host/path", and 
"content", the resulting path should be:

cache/gemini%3A%2F%2Fhost%2Fpath/content

And not:

cache%2Fgemini%3A%2F%2Fhost%2Fpath%2Fcontent

Which is clearly nonsensical.

> Ah.  See, I haven't needed that much functionality yet (and I suspect I
> could use my email parsers for that if I really needed it).

Yes, email.lua would handle a message/rfc822 part. It's a start :)

https://github.com/spc476/LPeg-Parsers/blob/master/email.lua

---

Previous in thread (108 of 109): 🗣️ Sean Conner (sean (a) conman.org)

View entire thread.