I use a forum that has a policy against direct commercial links, so what I often do is to mangle it so it remains readable but requires manual copy/paste/edit in order to work. Instead of www.example.com I will use www•example•com . The SO post editor encodes that URI as you'd expect, replacing the •
with %E2%80%A2
(so https://www%E2%80%A2example%E2%80%A2com
) but when I click the link I'm taken to https://xn--wwwexamplecom-kt6gha . That is also the HREF that the forum sends back after posting.
The xn--
header seems to be constant, the "glueing" of the 1st two domain components too but annoyingly the rest varies as a function of the domain name. The -kt6gha
bit is domain-specific and the TLD can be glued to the rest as here or come after that alphanumeric part.
I'm guessing this conversion is deterministic, but can it be reversed? Preferably in a userscript.js so I can undo my own smart move for myself? ;)