summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-06-11 09:57:49 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-06-11 09:57:49 (GMT)
commit81eb74be3a54a5ed3df1ae396b5a0ae38ce991a2 (patch)
treecde787ed29aec69b639b6bc9a152fc04b90dc28c /doc
parentc964dc0005b9d693cb9aa616a136fc49191a9720 (diff)
downloadtcl-81eb74be3a54a5ed3df1ae396b5a0ae38ce991a2.zip
tcl-81eb74be3a54a5ed3df1ae396b5a0ae38ce991a2.tar.gz
tcl-81eb74be3a54a5ed3df1ae396b5a0ae38ce991a2.tar.bz2
Add missing "METHOD profile", some paragraph markers and formatting in examples (last one comes from "encoding-for-review" branch)
Diffstat (limited to 'doc')
-rw-r--r--doc/encoding.n25
1 files changed, 14 insertions, 11 deletions
diff --git a/doc/encoding.n b/doc/encoding.n
index f350d34..4377471 100644
--- a/doc/encoding.n
+++ b/doc/encoding.n
@@ -30,19 +30,21 @@ Performs one of several encoding related operations, depending on
.\" METHOD: convertfrom
.TP
\fBencoding convertfrom\fR ?\fIencoding\fR? \fIdata\fR
+.VS "TCL8.7 TIP607, TIP656"
.TP
\fBencoding convertfrom\fR ?\fB-profile \fIprofile\fR? ?\fB-failindex var\fR? \fIencoding data\fR
+.VE "TCL8.7 TIP607, TIP656"
.
Converts \fIdata\fR, which should be in binary string encoded as per
\fIencoding\fR, to a Tcl string. If \fIencoding\fR is not specified, the current
system encoding is used.
-
+.PP
.VS "TCL8.7 TIP607, TIP656"
The \fB-profile\fR option determines the command behavior in the presence
of conversion errors. See the \fBPROFILES\fR section below for details. Any premature
termination of processing due to errors is reported through an exception if
the \fB-failindex\fR option is not specified.
-
+.PP
If the \fB-failindex\fR is specified, instead of an exception being raised
on premature termination, the result of the conversion up to the point of the
error is returned as the result of the command. In addition, the index
@@ -60,7 +62,7 @@ Convert \fIstring\fR to the specified \fIencoding\fR. The result is a Tcl binary
string that contains the sequence of bytes representing the converted string in
the specified encoding. If \fIencoding\fR is not specified, the current system
encoding is used.
-
+.PP
.VS "TCL8.7 TIP607, TIP656"
The \fB-profile\fR and \fB-failindex\fR options have the same effect as
described for the \fBencoding convertfrom\fR command.
@@ -89,9 +91,10 @@ The encodings
and
.QW iso8859-1
are guaranteed to be present in the list.
-.VS "TCL8.7 TIP656"
+.\" METHOD: profiles
.TP
\fBencoding profiles\fR
+.VS "TCL8.7 TIP656"
Returns a list of the names of encoding profiles. See \fBPROFILES\fR below.
.VE "TCL8.7 TIP656"
.\" METHOD: system
@@ -200,18 +203,18 @@ The letter \fBA\fR is Unicode character U+0041 and the byte "\ex80" is invalid
in ASCII encoding.
.PP
.CS
-% codepoints [encoding convertfrom -profile tcl8 ascii A\ex80]
+% codepoints [\fBencoding convertfrom\fR -profile tcl8 ascii A\ex80]
U+000041 U+000080
-% codepoints [encoding convertfrom -profile replace ascii A\ex80]
+% codepoints [\fBencoding convertfrom\fR -profile replace ascii A\ex80]
U+000041 U+00FFFD
-% codepoints [encoding convertfrom -profile strict ascii A\ex80]
+% codepoints [\fBencoding convertfrom\fR -profile strict ascii A\ex80]
unexpected byte sequence starting at index 1: '\ex80'
.CE
.PP
Example 3: Get partial data and the error location:
.PP
.CS
-% codepoints [encoding convertfrom -profile strict -failindex idx ascii AB\ex80]
+% codepoints [\fBencoding convertfrom\fR -profile strict -failindex idx ascii AB\ex80]
U+000041 U+000042
% set idx
2
@@ -220,11 +223,11 @@ U+000041 U+000042
Example 4: Encode a character that is not representable in ISO8859-1:
.PP
.CS
-% encoding convertto iso8859-1 A\eu0141
+% \fBencoding convertto\fR iso8859-1 A\eu0141
A?
-% encoding convertto -profile strict iso8859-1 A\eu0141
+% \fBencoding convertto\fR -profile strict iso8859-1 A\eu0141
unexpected character at index 1: 'U+000141'
-% encoding convertto -profile strict -failindex idx iso8859-1 A\eu0141
+% \fBencoding convertto\fR -profile strict -failindex idx iso8859-1 A\eu0141
A
% set idx
1