Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: f9d1388075e26a4914c93e9fd6864d94f5ce172a
Ticket: 217812ffffffffffffffffffffffffffffffffff
Locale support missing (patch)
User & Date: nobody on 2000-10-26 00:44:00
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    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
    
  4. foundin changed to: "obsolete: 8.0.4"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "69. Other"
  10. title changed to: "Locale support missing (patch)"
  11. type changed to: "Bug"