summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/Encoding.36
-rw-r--r--generic/tclTest.c2
-rw-r--r--tests/encoding.test11
3 files changed, 18 insertions, 1 deletions
diff --git a/doc/Encoding.3 b/doc/Encoding.3
index 86c5a78..c183b73 100644
--- a/doc/Encoding.3
+++ b/doc/Encoding.3
@@ -52,6 +52,9 @@ const char *
\fBTcl_GetEncodingName\fR(\fIencoding\fR)
.sp
int
+\fBTcl_GetEncodingNulLength\fR(\fIencoding\fR)
+.sp
+int
\fBTcl_SetSystemEncoding\fR(\fIinterp, name\fR)
.sp
const char *
@@ -292,6 +295,9 @@ was used to create the encoding. The string returned by
\fBTcl_GetEncodingName\fR is only guaranteed to persist until the
\fIencoding\fR is deleted. The caller must not modify this string.
.PP
+\fBTcl_GetEncodingNulLength\fR returns the length of the terminating
+nul byte sequence for strings in the specified encoding.
+.PP
\fBTcl_SetSystemEncoding\fR sets the default encoding that should be used
whenever the user passes a NULL value for the \fIencoding\fR argument to
any of the other encoding functions. If \fIname\fR is NULL, the system
diff --git a/generic/tclTest.c b/generic/tclTest.c
index ae765aa..2764ced 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -2003,7 +2003,7 @@ TestencodingObjCmd(
};
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 2, objv, "?encoding?");
+ Tcl_WrongNumArgs(interp, 1, objv, "command ?args?");
return TCL_ERROR;
}
diff --git a/tests/encoding.test b/tests/encoding.test
index c8f409e..8e529af 100644
--- a/tests/encoding.test
+++ b/tests/encoding.test
@@ -841,6 +841,17 @@ runtests
}
+test encoding-29.0 {get encoding nul terminator lengths} -constraints {
+ testencoding
+} -body {
+ list \
+ [testencoding nullength ascii] \
+ [testencoding nullength utf-16] \
+ [testencoding nullength utf-32] \
+ [testencoding nullength gb12345] \
+ [testencoding nullength ksc5601]
+} -result {1 2 4 2 2}
+
# cleanup
namespace delete ::tcl::test::encoding
::tcltest::cleanupTests