Artifact 1cd5e79d37e872b90ff48afee79f9a56cc1f57744365bd2c4798e31b5a4cd2da:
- File doc/markdown/Tcl/idna.md — part of check-in [3a2c50060c] at 2026-11-05 22:52:39 on branch tip-700 — - fixed a bug in man2markdown.tcl, leaving a method unparsed when coming after an .RS/.RE - fixed regression for methods under a "see below" definition - further unification of 5 pages: array.n, chan.n, dict.n, info.n, trace.n - updates to 19 markdown pages where a method had been unrecognized - updated README to reflect current state for Tk man page conversion (user: Torsten, size: 2737) [annotate] [blame] [check-ins using]
CommandName: idna title: idna ManualSection: n Version: 0.1 TclPart: http TclDescription: Tcl Bundled Packages Links:
- http(n)
- cookiejar(n) Keywords:
- internet
- www Copyright:
- Copyright (c) 2014-2018 Donal K. Fellows. ---
Name
tcl::idna - Support for normalization of Internationalized Domain Names
Synopsis
::: {.synopsis} ::: [package]{.cmd} [require]{.sub} [tcl::idna]{.lit} [1.0]{.lit}
[tcl::idna]{.cmd} [decode]{.sub} [hostname]{.arg} [tcl::idna]{.cmd} [encode]{.sub} [hostname]{.arg} [tcl::idna]{.cmd} [puny]{.sub} [decode]{.lit} [string]{.arg} [case]{.optarg} [tcl::idna]{.cmd} [puny]{.sub} [encode]{.lit} [string]{.arg} [case]{.optarg} [tcl::idna]{.cmd} [version]{.sub} :::
Description
This package provides an implementation of the punycode scheme used in Internationalised Domain Names, and some access commands. (See RFC 3492 for a description of punycode.)
[tcl::idna]{.cmd} [decode]{.sub} [hostname]{.arg} : This command takes the name of a host that potentially contains punycode-encoded character sequences, hostname, and returns the hostname as might be displayed to the user. Note that there are often UNICODE characters that have extremely similar glyphs, so care should be taken with displaying hostnames to users.
[tcl::idna]{.cmd} [encode]{.sub} [hostname]{.arg} : This command takes the name of a host as might be displayed to the user, hostname, and returns the version of the hostname with characters not permitted in basic hostnames encoded with punycode.
[tcl::idna]{.cmd} [puny]{.sub} [subcommand]{.arg} [...]{.arg} : This command provides direct access to the basic punycode encoder and decoder. It supports two subcommands:
**tcl::idna puny decode** *string* ?*case*?
: This command decodes the punycode-encoded string, *string*, and returns the result. If *case* is provided, it is a boolean to make the case be folded to upper case (if *case* is true) or lower case (if *case* is false) during the decoding process; if omitted, no case transformation is applied.
**tcl::idna puny encode** *string* ?*case*?
: This command encodes the string, *string*, and returns the punycode-encoded version of the string. If *case* is provided, it is a boolean to make the case be folded to upper case (if *case* is true) or lower case (if *case* is false) during the encoding process; if omitted, no case transformation is applied.
[tcl::idna]{.cmd} [version]{.sub} : This returns the version of the tcl::idna package.
Example
This is an example of how punycoding of a string works:
package require tcl::idna
puts [tcl::idna puny encode "abc→def"]
# prints: abcdef-kn2c
puts [tcl::idna puny decode "abcdef-kn2c"]
# prints: abc→def