idna(n)
π idna(n) β the manual, but make it make sense β¨
okay bestie, pull up a chair π«Ά this is idna, a Tcl Bundled Package, and it's literally the thing that makes internationalized domain names work. no cap.
β¨ NAME β¨
tcl::idna β Support for normalization of Internationalized Domain Names
πΈ SYNOPSIS πΈ
package require tcl::idna 1.0
tcl::idna decode hostname
tcl::idna encode hostname
tcl::idna puny decode string ?case?
tcl::idna puny encode string ?case?
tcl::idna version
π¦ DESCRIPTION π¦
so basically this package is a whole implementation of the punycode scheme β the one they use for Internationalised Domain Names β plus a couple of little access commands so you can actually talk to it. if you want the full lore, it's described in RFC 3492. iykyk π
π tcl::idna decode hostname
this one takes the name of a host that might contain punycode-encoded character sequences, hostname, and gives you back the hostname as it might be displayed to the user. so like, the pretty version β¨
β οΈ real talk though: there are often UNICODE characters that have extremely similar glyphs, so be careful when you're displaying hostnames to users. a scammy lookalike is not the vibe. π©
π tcl::idna encode hostname
the other direction, bestie. you hand it the name of a host as it might be displayed to the user, hostname, and it returns the version of that hostname where all the characters that aren't permitted in basic hostnames get encoded with punycode. π
π tcl::idna puny subcommand ...
this is the direct line to the basic punycode encoder and decoder. no middleman, just vibes. it supports two subcommands:
π tcl::idna puny decode string ?case?
decodes the punycode-encoded string and returns the result. now about that optional case β it's a boolean, and it controls whether the case gets folded during the decoding process: to upper case if case is true, or to lower case if case is false. if you just... don't pass it? then no case transformation happens at all. periodt.
π tcl::idna puny encode string ?case?
encodes string and returns the punycode-encoded version of it. same deal with case: it's a boolean, and it folds the case during the encoding process to upper case if case is true and to lower case if case is false. omit it and, once again, no case transformation is applied. π
π tcl::idna version
returns the version of the tcl::idna package. that's it. that's the whole command. iconic honestly. β
π EXAMPLE π
here's how the punycoding of a string works, watch this:
package require tcl::idna
puts [tcl::idna puny encode "abcβdef"]
# prints: abcdef-kn2c
puts [tcl::idna puny decode "abcdef-kn2c"]
# prints: abcβdef
the way it just round-trips πβ¨ obsessed.
π§ SEE ALSO π§
π KEYWORDS π
- internet
- www
and that's the whole page, bestie π«Ά this one comes to you from http, version 0.1, dated idna(n) β go forth and punycode responsibly π ππ
π¦ where this page comes from
- alpine 3.23: tcl9-doc 9.0.3-r0 Β· TCL
- alpine 3.24: tcl9-doc 9.0.3-r2 Β· TCL
- fedora 43: tcl-doc 1:9.0.2-1.fc43 Β· TCL AND GPL-3.0-or-later WITH Bison-exception-2.2 AND BSD-3-Clause
- fedora 44: tcl-doc 1:9.0.2-1.fc44 Β· TCL AND GPL-3.0-or-later WITH Bison-exception-2.2 AND BSD-3-Clause
- nixos 26.05: tcl 9.0.3
- Copyright (c) 2014-2018 Donal K. Fellows
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms