IDNA::Punycode(3pm)

πŸ“¦
version 1.100 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ¦‹ IDNA::Punycode πŸ’–

okay bestie, gather round, because this is IDNA::Punycode(3pm), straight out of the User Contributed Perl Documentation section, and the vibes are... complicated. she's giving legacy. she's giving "still here for the girls who need her." let's get into it. ✨


🌸 NAME 🌸

IDNA::Punycode β€” the DEPRECATED module for IDNA and Punyode 🫢

(no that's not a typo I made, the page literally says "Punyode", and honestly? iconic of her.)


πŸ’œ DESCRIPTION πŸ’œ

so. the tea. this module is deprecated. like, officially. she said "I'm retiring, but I'm not leaving." 😭

please use Net::IDN::Encode to handle full domain names, and Net::IDN::Punycode for raw Punycode encoding. those are the main characters now. πŸ‘‘

this module is only hanging around for compatibility with earlier versions of IDNA::Punycode. so if you're here, it's probably because something old needs her, and that's valid. we don't judge. πŸŽ€


✨ FUNCTIONS ✨

the following functions are imported by default. so if you also use Net::IDN::Punycode, be sure to disable import from this module, or they'll be fighting in the group chat:

  use IDNA::Punycode();

🌈 idn_prefix($prefix)

sets $IDNA::Punycode::PREFIX to $prefix. simple. clean. done. πŸ’…

⚠️ do not use this function in larger applications, or in environments where multiple applications share global variables (looking at you, mod_perl). instead, set the variable locally like the responsible queen you are:
  local $IDNA::Punycode::PREFIX = 'yo--';

πŸ“ encode_punycode($input)

  • if $IDNA::Punycode::PREFIX is '', it encodes $input with Punycode.
  • if $IDNA::Punycode::PREFIX is not '', it encodes $input with Punycode and adds the prefix β€” but only if $input actually contains non-base characters (i.e. characters above U+007F). if $input has no non-base characters at all, it gets returned as-is. no notes, no changes, we love a chill return. 😌

okay but real talk β€” this function does not do any string preparation as specified by nameprep or other stringprep profiles. none. zero. if you just want to convert a domain name, use Net::IDN::Encode. please. for me. πŸ™

and heads up: this function will croak on invalid input. πŸ’€

🧚 decode_punycode($input)

  • if $IDNA::Punycode::PREFIX is '', it decodes $input with Punycode.
  • if $IDNA::Punycode::PREFIX is not '', it checks whether $input starts with the prefix. if it does, the prefix is removed and the remainder is decoded with Punycode. if $input does not start with the prefix, it's returned as-is. no drama, no decoding, just vibes. 🌸

and of course β€” this function does not do any string preparation as specified by nameprep or other stringprep profiles (or some sort of de-preparation). like, at all. bestie, it's not that kind of function. 🫠

this one will also croak on invalid input. πŸ’€


πŸ‘‘ AUTHORS πŸ‘‘

Claus Faerber <CFAERBER@cpan.org>

previous version written by Tatsuhiko Miyagawa <miyagawa@bulknews.net> and extended by Robert Urban <urban@UNIX-Beratung.de>. absolute legends, all three. 🫢


πŸŽ€ LICENSE πŸŽ€

Copyright 2007-2010 Claus Faerber.

this library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. so like, go off. ✨


πŸ”₯ SEE ALSO πŸ”₯


and that's the whole page, bestie!! πŸ¦‹ this was IDNA::Punycode(3pm) from perl v5.26.2, dated 2018-09-01, and she's serving deprecated-but-iconic realness. lowkey she ate. πŸ’…βœ¨ mwah, love u, bye!! πŸ’–πŸŒˆβ­

πŸ“¦ where this page comes from