Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 55c70c987c3798a671c30b33f7fab26ee3502cd1
Ticket: 218100ffffffffffffffffffffffffffffffffff
Tcl_Eval does not treat a command the same as in the console
User & Date: nobody on 2000-10-26 00:53:09
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 1803 Bug
    Version: 8.1b3
    SubmitDate: '1999-04-14'
    LastModified: '2000-04-03'
    Severity: SER
    Status: Closed
    Submitter: pat
    ChangedBy: hobbs
    OS: Windows 95
    Machine: X86
    FixedDate: '2000-10-25'
    ClosedDate: '2000-04-03'
    
    
    Name:
    Di Yu
    
    Comments:
    This is a very bad problem as it makes the compilation of programs
        containing Chinese words virtually impossible. I don't know why Tcl_Eval
        think the string is 5-bytes with the third one as Unicode \u04dd, and
        not 6-bytes as the console treat it. In fact, when I try to compile a
        program which contains "encoding convertfrom gb2212 ...", the generated
        executable can hardly do any correct converting.
    
    ReproducibleScript:
    #include <tcl.h>
        void main(int argc, char **argv)
        {
            Tcl_Interp *Interp=Tcl_CreateInterp();
            Tcl_Init(Interp);
            Tcl_Eval(Interp, "set s ÏÂ?Ìâ");
            Tcl_Eval(Interp, "for {set i 0} {$i<[string length $s]} {incr i}
        {set c [string index $s $i]; scan $c \"%c\" code; puts [format \"%x\"
        $code];}");
            Tcl_DeleteInterp(Interp);
            exit(1);
        }
    
    ObservedBehavior:
    The program, after compiled to an executable file(under Windows, using
        VC++5.0), gives the following result when executed:
        
        cf
        c2
        4bb
        cc
        e2
    
    DesiredBehavior:
    It should give:
        
        cf
        c2
        d2
        bb
        cc
        e2
        
        just as the same script would give when executed in the wish console.
    
    
    
    There is slight confusion here, because the console has an
    implicit encoding phase the that user is ignoring.  The user
    wants to do Tcl_ExternalToUtfDString to have this evaluate
    correctly, or include some other conversion step at the C
    level, to make up for the lack of internal recoding that the
    console does for us. 
    -- 04/03/2000 hobbs
    
  4. foundin changed to: "obsolete: 8.1b3"
  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: "57. zlib"
  10. title changed to:
    Tcl_Eval does not treat a command the same as in the console
    
  11. type changed to: "RFE"