summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/Encoding.327
-rw-r--r--generic/tcl.decls8
-rw-r--r--generic/tclDecls.h9
-rw-r--r--generic/tclInt.h11
-rw-r--r--generic/tclStubInit.c3
-rw-r--r--unix/tclUnixInit.c6
6 files changed, 43 insertions, 21 deletions
diff --git a/doc/Encoding.3 b/doc/Encoding.3
index 45398f3..305edbb 100644
--- a/doc/Encoding.3
+++ b/doc/Encoding.3
@@ -8,7 +8,7 @@
.so man.macros
.BS
.SH NAME
-Tcl_GetEncoding, Tcl_FreeEncoding, Tcl_GetEncodingFromObj, Tcl_ExternalToUtfDString, Tcl_ExternalToUtfDStringEx, Tcl_ExternalToUtf, Tcl_UtfToExternalDString, Tcl_UtfToExternalDStringEx, Tcl_UtfToExternal, Tcl_GetEncodingName, Tcl_SetSystemEncoding, Tcl_GetEncodingNameFromEnvironment, Tcl_GetEncodingNames, Tcl_CreateEncoding, Tcl_GetEncodingSearchPath, Tcl_SetEncodingSearchPath \- procedures for creating and using encodings
+Tcl_GetEncoding, Tcl_FreeEncoding, Tcl_GetEncodingFromObj, Tcl_ExternalToUtfDString, Tcl_ExternalToUtfDStringEx, Tcl_ExternalToUtf, Tcl_UtfToExternalDString, Tcl_UtfToExternalDStringEx, Tcl_UtfToExternal, Tcl_GetEncodingName, Tcl_SetSystemEncoding, Tcl_GetEncodingNameFromEnvironment, Tcl_GetEncodingNameForUser, Tcl_GetEncodingNames, Tcl_CreateEncoding, Tcl_GetEncodingSearchPath, Tcl_SetEncodingSearchPath \- procedures for creating and using encodings
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
@@ -53,6 +53,9 @@ int
const char *
\fBTcl_GetEncodingNameFromEnvironment\fR(\fIbufPtr\fR)
.sp
+const char *
+\fBTcl_GetEncodingNameForUser\fR(\fIbufPtr\fR)
+.sp
\fBTcl_GetEncodingNames\fR(\fIinterp\fR)
.sp
Tcl_Encoding
@@ -308,12 +311,22 @@ procedure increments the reference count of the new system encoding,
decrements the reference count of the old system encoding, and returns
\fBTCL_OK\fR.
.PP
-\fBTcl_GetEncodingNameFromEnvironment\fR provides a means for the Tcl
-library to report the encoding name it believes to be the correct one
-to use as the system encoding, based on system calls and examination of
-the environment suitable for the platform. It accepts \fIbufPtr\fR,
-a pointer to an uninitialized or freed \fBTcl_DString\fR and writes
-the encoding name to it. The \fBTcl_DStringValue\fR is returned.
+\fBTcl_GetEncodingNameFromEnvironment\fR retrieves the encoding name to
+use as the system encoding. On non-Windows platforms, this is derived
+from the \fBnl_langinfo\fR system call if available, and environment
+variables \fBLC_ALL\fR, \fBLC_CTYPE\fR or \fBLANG\fR otherwise. On
+Windows versions Windows 10 Build 18362 and later the returned value is
+always \fButf-8\fR. On earlier Windows versions, it is derived from the
+user settings in the Windows registry. \fBTcl_GetEncodingNameForUser\fR
+retrieves the encoding name based on the user settings for the current
+user and is derived in the same manner as
+\fBTcl_GetEncodingNameFromEnvironment\fR on non-Windows platforms. On
+Windows, unlike \fBTcl_GetEncodingNameFromEnvironment\fR, it returns the
+encoding name as per the Windows registry settings irrespective of the
+Windows version. Both functions accept \fIbufPtr\fR, a pointer to an
+uninitialized or freed \fBTcl_DString\fR and write the encoding name to
+it. They return \fBTcl_DStringValue(bufPtr)\fR which points to the stored
+name.
.PP
\fBTcl_GetEncodingNames\fR sets the \fIinterp\fR result to a list
consisting of the names of all the encodings that are currently defined
diff --git a/generic/tcl.decls b/generic/tcl.decls
index 05849fc..175b29a 100644
--- a/generic/tcl.decls
+++ b/generic/tcl.decls
@@ -2367,13 +2367,19 @@ declare 689 {
# ----- BASELINE -- FOR -- 9.0.0 ----- #
+# TIP 711
declare 690 {
int Tcl_IsEmpty(Tcl_Obj *obj)
}
+# TIP 716
+declare 691 {
+ const char *Tcl_GetEncodingNameForUser(Tcl_DString *bufPtr)
+}
+
# ----- BASELINE -- FOR -- 9.1.0 ----- #
-declare 691 {
+declare 692 {
void TclUnusedStubEntry(void)
}
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index 47f6b9a..694f8b4 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -1873,6 +1873,8 @@ EXTERN void Tcl_SetWideUIntObj(Tcl_Obj *objPtr,
/* 690 */
EXTERN int Tcl_IsEmpty(Tcl_Obj *obj);
/* 691 */
+EXTERN const char * Tcl_GetEncodingNameForUser(Tcl_DString *bufPtr);
+/* 692 */
EXTERN void TclUnusedStubEntry(void);
typedef struct {
@@ -2576,7 +2578,8 @@ typedef struct TclStubs {
Tcl_Obj * (*tcl_NewWideUIntObj) (Tcl_WideUInt wideValue); /* 688 */
void (*tcl_SetWideUIntObj) (Tcl_Obj *objPtr, Tcl_WideUInt uwideValue); /* 689 */
int (*tcl_IsEmpty) (Tcl_Obj *obj); /* 690 */
- void (*tclUnusedStubEntry) (void); /* 691 */
+ const char * (*tcl_GetEncodingNameForUser) (Tcl_DString *bufPtr); /* 691 */
+ void (*tclUnusedStubEntry) (void); /* 692 */
} TclStubs;
extern const TclStubs *tclStubsPtr;
@@ -3908,8 +3911,10 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_SetWideUIntObj) /* 689 */
#define Tcl_IsEmpty \
(tclStubsPtr->tcl_IsEmpty) /* 690 */
+#define Tcl_GetEncodingNameForUser \
+ (tclStubsPtr->tcl_GetEncodingNameForUser) /* 691 */
#define TclUnusedStubEntry \
- (tclStubsPtr->tclUnusedStubEntry) /* 691 */
+ (tclStubsPtr->tclUnusedStubEntry) /* 692 */
#endif /* defined(USE_TCL_STUBS) */
diff --git a/generic/tclInt.h b/generic/tclInt.h
index c9c333f..6e41c7d 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -3103,16 +3103,7 @@ MODULE_SCOPE int TclEncodingProfileNameToId(Tcl_Interp *interp,
MODULE_SCOPE const char *TclEncodingProfileIdToName(Tcl_Interp *interp,
int profileId);
MODULE_SCOPE void TclGetEncodingProfiles(Tcl_Interp *interp);
-/* TIP 716 - MODULE_SCOPE for 9.0.2. Will be public in 9.1 */
-#ifdef _WIN32
-MODULE_SCOPE const char *Tcl_GetEncodingNameForUser(Tcl_DString *bufPtr);
-#else
-static inline const char *
-Tcl_GetEncodingNameForUser(Tcl_DString *bufPtr)
-{
- return Tcl_GetEncodingNameFromEnvironment(bufPtr);
-}
-#endif
+
/*
* TIP #233 (Virtualized Time)
* Data for the time hooks, if any.
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 8839e0b..2fd9bea 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -1498,7 +1498,8 @@ const TclStubs tclStubs = {
Tcl_NewWideUIntObj, /* 688 */
Tcl_SetWideUIntObj, /* 689 */
Tcl_IsEmpty, /* 690 */
- TclUnusedStubEntry, /* 691 */
+ Tcl_GetEncodingNameForUser, /* 691 */
+ TclUnusedStubEntry, /* 692 */
};
/* !END!: Do not edit above this line. */
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index e59b3ee..ef62400 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -694,6 +694,12 @@ Tcl_GetEncodingNameFromEnvironment(
return Tcl_DStringAppend(bufPtr, TCL_DEFAULT_ENCODING, TCL_INDEX_NONE);
}
+const char *
+Tcl_GetEncodingNameForUser(Tcl_DString *bufPtr)
+{
+ return Tcl_GetEncodingNameFromEnvironment(bufPtr);
+}
+
/*
*---------------------------------------------------------------------------
*