Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-13
23:12 • Ticket [217812ffff] Locale support missing (patch) status still Closed with ... artifact: 385344e178 user: dgp
2000-10-26
07:49 • Closed ticket [217812ffff]. artifact: 76ef0a5bf8 user: welch
00:44 • New ticket [217812ffff]. artifact: f9d1388075 user: nobody

Locale support missing (patch)

Closed / Duplicate217812ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:44:00
OriginalBugID: 1352 Bug
Version: 8.0.4
SubmitDate: '1999-03-02'
LastModified: '1999-03-02'
Severity: SER
Status: Closed
Submitter: pat
ChangedBy: pat
OS: Linux
Machine: Other
FixedDate: '2000-10-25'
ClosedDate: '1999-03-02'


Name:

Victor Wagner



Extensions:

TclX , tix, expect



CustomShell:

Dash and Img patches are applied,



ReproducibleScript:

Locale support is missing from Tcl 8.0.x









ObservedBehavior:

This causes following problems:

1. string subcommands toupper tolower compare wordstart and wordend misbehave

  on nonenglish text

2. lsort doesn't follow national sorting rules

3. Tk doesn't allow to input non-ascii characters in properly localized X11









DesiredBehavior:

All of items above are fixed by following patch. lsort is fixed

in ASCII mode only.







Patch:

diff -urw tcl8.0.4/generic/tclCmdIL.c tcl8.0.4.rus/generic/tclCmdIL.c

--- tcl8.0.4/generic/tclCmdIL.cSat Oct 24 01:21:40 1998

+++ tcl8.0.4.rus/generic/tclCmdIL.cFri Feb 12 18:54:41 1999

@@ -2745,7 +2745,8 @@

 objPtr2 = objPtr;

     }

     if (infoPtr->sortMode == SORTMODE_ASCII) {

-order = strcmp(Tcl_GetStringFromObj(objPtr1, &dummy),

+        /* Fix by Boris Tobotras */

+        order = strcoll(Tcl_GetStringFromObj(objPtr1, &dummy),

 Tcl_GetStringFromObj(objPtr2, &dummy));

     } else if (infoPtr->sortMode == SORTMODE_DICTIONARY) {

 order = DictionaryCompare(

diff -urw tcl8.0.4/generic/tclCmdMZ.c tcl8.0.4.rus/generic/tclCmdMZ.c

--- tcl8.0.4/generic/tclCmdMZ.cMon Sep 14 22:39:57 1998

+++ tcl8.0.4.rus/generic/tclCmdMZ.cFri Feb 12 18:54:41 1999

@@ -1095,7 +1095,15 @@

     string2 = Tcl_GetStringFromObj(objv[3], &length2);

 

     length = (length1 < length2) ? length1 : length2;

-    match = memcmp(string1, string2, (unsigned) length);

+               { /* fix by Boris Tobotras */

+                       char *s1 = alloca( length + 1 ),

+                               *s2 = alloca( length + 1 );

+                       strncpy( s1, string1, length );

+                       strncpy( s2, string2, length );

+                       s1[ length ] = s2[ length ] = '\0';

+                       match = strcoll( s1, s2 );

+               } /* end fix */

+    

     if (match == 0) {

         match = length1 - length2;

     }

diff -urw tcl8.0.4/unix/tclUnixInit.c tcl8.0.4.rus/unix/tclUnixInit.c

--- tcl8.0.4/unix/tclUnixInit.cMon Sep 14 22:40:17 1998

+++ tcl8.0.4.rus/unix/tclUnixInit.cTue Feb 16 15:41:21 1999

@@ -23,6 +23,7 @@

 #   endif

 #endif

 

+#include <locale.h>

 /*

  * Default directory in which to look for Tcl library scripts.  The

  * symbol is defined by Makefile.

@@ -153,6 +154,11 @@

     if (!initialized) {

 

         /*

+ * Set locale. This probably should be done in other place,

+ * but I cannot imagine where

+ */

+ setlocale(LC_ALL,""); 

+        /*

          * Create an exit handler so that uninitialization will be done

          * on unload.

          */











PatchFiles:

tclUnixInit.c

tclCmdIL.c

tclCmdMZ.c









It seems that there is long way before 8.1 release with full i18n support.
So, non-US users of 8.0.x release should be able to use its native language.
Patch is trivial and can be applied to any version from Tcl 8.0p2 to
8.0.4 although applying to early version may require some manual work.

If you have Tcl build with --enable-shared, this patch fixes problems
with all Tcl interpreters in system at once.

03/02/1999 17:17 - pat -duplicate of bug 1251
welch Closed ticket [217812ffff]. [History diff]2000-10-26 07:49:19
dgp Ticket [217812ffff]: 3 changes [History diff]2001-04-13 23:12:00
Log in (anonymous is fine) to add a comment.