beetlebug▾
/

encoding system

Gives or sets the system encoding.

encoding system ?ENCODING?

Description

With no argument, gives the name of the system encoding: the encoding of convertto and convertfrom with one argument. It is utf-8 at the start. A new channel has the encoding utf-8, whatever the system encoding is.

With ENCODING, sets the system encoding and gives an empty string. ENCODING must be a known encoding.

Arguments

ArgumentTypeDefaultDescription
ENCODINGencoding namenoneThe new system encoding.

Returns

The name of the system encoding, or an empty string after a set.

Examples

% encoding system
utf-8

% encoding system iso8859-1; encoding system
iso8859-1

Errors

% encoding system bogus
unknown encoding "bogus"
-errorcode TCL LOOKUP ENCODING bogus

% encoding system a b
wrong # args: should be "encoding system ?encoding?"
-errorcode TCL WRONGARGS

Facts

Capability
channels. A new interpreter does not have it until the host turns it on.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.1

See also