A new repository is now available for working with Internationalized Domain Names (IDN) in FreePascal:
🔗
https://github.com/Al-Muhandis/fp-idn/The repo implements Punycode encoding/decoding, fully RFC 3492-compliant. While it’s designed for domain names in Unicode, it can also be used in any context where you need to safely convert Unicode strings into ASCII — such as storing or transmitting identifiers in URLs or file names.
writeln(PunycodeEncode('пример')); // -> e1afmkfd
writeln(UnicodeToIDN('mail.пример.рф')); // -> mail.xn--e1afmkfd.xn--p1ai
Includes unit tests and performance benchmarks.
Feedback, bug reports, and contributions are very welcome!
P.S. It also supports four-byte code points, unlike other implementations (that is, it covers the entire space, including emojis, for example)