Recent

Author Topic: IDNA / Punycode converter  (Read 177 times)

Renat.Su

  • Sr. Member
  • ****
  • Posts: 253
    • Renat.Su
IDNA / Punycode converter
« on: June 10, 2025, 08:48:36 pm »
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.
Code: [Select]
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)

 

TinyPortal © 2005-2018