summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixInit.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-07-01 19:39:46 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-07-01 19:39:46 (GMT)
commit47e20645223b8125616a995358175374ec025f7c (patch)
treeeaa76861fb404d98f8752d7b83265318868def2e /unix/tclUnixInit.c
parente30fcdf4bab58d38b5dc79e74e7b48a71086d475 (diff)
parent6e5a44be9a62019141dc57ef80e56145fd22b43c (diff)
downloadtcl-47e20645223b8125616a995358175374ec025f7c.zip
tcl-47e20645223b8125616a995358175374ec025f7c.tar.gz
tcl-47e20645223b8125616a995358175374ec025f7c.tar.bz2
Fix [5fca83d78c]: [encoding system] is wrong in an ISO-8859-1 locale
Diffstat (limited to 'unix/tclUnixInit.c')
-rw-r--r--unix/tclUnixInit.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index 63167c6..9f19075 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -597,17 +597,21 @@ SearchKnownEncodings(
int left = 0;
int right = sizeof(localeTable)/sizeof(LocaleTable);
+ /* Here, search for i in the interval left <= i < right. */
while (left < right) {
int test = (left + right)/2;
int code = strcmp(localeTable[test].lang, encoding);
if (code == 0) {
+ /* Found it at i == test. */
return localeTable[test].encoding;
}
if (code < 0) {
+ /* Restrict the search to the interval test < i < right. */
left = test+1;
} else {
- right = test-1;
+ /* Restrict the search to the interval left <= i < test. */
+ right = test;
}
}
return NULL;