encoding
encoding option ?arg ...?
Changes text to bytes and back. ztcl stores text as UTF-8.
Subcommands
| Synopsis | What it does |
|---|---|
encoding convertto ?-profile PROFILE? ?-failindex VAR? ENCODING STRING |
The bytes of STRING in ENCODING, as a byte string. The options are in Tcl 9.1 only. |
encoding convertfrom ?-profile PROFILE? ?-failindex VAR? ENCODING BYTES |
The text of BYTES in ENCODING. In Tcl 9.1 the default profile strict makes a bad byte an error, and -failindex VAR gives the text before it and puts its index in VAR. The profile replace puts U+FFFD for a bad byte, and tcl8 keeps the behavior of Tcl 8.6. The options are in Tcl 9.1 only. |
encoding profiles |
The profiles: replace strict tcl8. Tcl 9.1 only. |
encoding user |
The encoding of the user: utf-8. Tcl 9.1 only. |
encoding names |
The names of the encodings: the ones with no table, and the files of the encoding folders. |
encoding system |
The encoding of the system: utf-8. |
encoding dirs ?LIST? |
The folders of the encoding files of Tcl (koi8-r.enc, iso2022-jp.enc, ...). ztcl reads a file on the first use of its encoding, from these folders. Before a script sets the list, the folder is $tcl_library/encoding. The binary has no tables. |
Examples
string length [encoding convertto utf-8 é]gives2
Facts
- Capability:
channels. A new interpreter does not have this command. See Limits and capabilities. - Compute cost: one compute unit for the call, and more for the commands that it runs.