Skip to content
Tcl Source Code History Of Ticket 3483277fffffffff
Login

History Of Ticket 3483277fffffffff

Artifacts Associated With Ticket 3483277fffffffff

  1. Ticket change [8dc201f9c8] (rid 127993) by dalkunte on 2012-02-02 16:53:41:

    1. assignee initialized to: "hobbs"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
       Hi
       We are using TCL as an integrated scripting language in our application. But after upgrading TCL version from 8.3 to 8.5 we have started facing problem with the command “string map” below is code where the output of  “string map” is incorrect.
       -------------------------------------------------------
      
       set a "TEST1°TEST2°TEST3°TEST4°TEST5°A-B-C-D-E-F"
       puts $a
       #content of the variable a : TEST1°TEST2°TEST3°TEST4°TEST5°A-B-C-D-E-F
       set a [string map { "-" ";" } $a]
       puts $a
       #content of the variable a : TEST1ï¾°TEST2ï¾°TEST3ï¾°TEST4ï¾°TEST5ï¾°A;B;C;D;E;F
       -----------------------------------------------------------
       In the output of "string map" degree sign (°) is getting converted into ï¾°. Similar code was working correctly with Tcl version 8.3.
      
       Thanks
      
    4. foundin initialized to: "obsolete: 8.5.10"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "dalkunte"
    10. subsystem initialized to: "11. Conversions from String"
    11. title initialized to: "Problem with command "string map" in Tcl 8.5"
    12. type initialized to: "Bug"
  2. Ticket change [c8e56f3326] (rid 122185) by dgp on 2012-02-03 00:50:45:

    1. assignee changed to: "dgp"
    2. closedate changed to: "2012-02-02T17:50:45"
    3. closer changed to: "dgp"
    4. icomment:
      I suspect your script is not in the proper encoding.
      
      How do the commands above reach the interpreter?
      Are they stored in a file, and brought in with the [source]
      command?  If so, is that file stored in the encoding returned
      by the [encoding system] command?  If not, it's your job
      to tell [source] your script file is not in the default encoding
      by passing the proper -encoding value.
      
      The alternative, which is the more common approach, is to
      write your script files using only ASCII characters, and use
      \uHHHH substitution to encode any literal characters in your
      script outside that character range.
      
      
    5. login: "dgp"
    6. mimetype: "text/plain"
    7. resolution changed to: "Invalid"
    8. status changed to: "Pending"
    9. username: "dgp"
  3. Ticket change [9c489c1903] (rid 96125) by dgp on 2012-02-03 00:56:47:

    1. icomment:
      Reading again, you say you use Tcl as an "integrated
      scripting language" which suggests the commands above
      may be reaching the interpreter via a call into the Tcl library
      like
      
          Tcl_Eval(interp, script);
      
      or any of the other routines in the Tcl*Eval* family.
      
      In that case it is the responsibility of the Tcl_*Eval*
      caller to pass in the (char *) argument "script" a pointer
      to a character buffer holding your script in Tcl's internal
      encoding, which is a variant of utf-8.  The Tcl routine
      Tcl_ExternalToUtfDString() is usually a useful tool in getting
      that done properly.
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  4. Ticket change [df0565477c] (rid 114947) by dalkunte on 2012-02-03 13:20:58:

    1. icomment:
      Hi Don,
      Thanks for your update.
      
      We are using TCL_EvalFile to evaluate the contents of the TCl script as below.
      
      Tcl_EvalFile( interp, full_path_tcl_script)
      
       File which is passed as a parameter to this Tcl_EvalFile is a ascii file.  When you say “it is the responsibility of the Tcl_*Eval* caller to pass in the (char *) argument "script" a pointer to a character buffer holding your script in Tcl's internal encoding, which is a variant of utf-8.”
      Does that mean the file which is passed to TCL_EvalFile function should be in utf8 format? Please correct me if I am wrong.
      
      Also I am not able to understand why this was working correctly with Tcl version 8.3 and not working with Tcl version 8.5? Are there any encoding related changes done in Tcl version 8.5.  
      
      Thanks
      
      
      
    2. login: "dalkunte"
    3. mimetype: "text/plain"
    4. status changed to: "Open"
    5. username: "dalkunte"
  5. Ticket change [0773c3352f] (rid 89402) by sebres on 2012-02-03 16:52:22:

    1. icomment:
      the Tcl_EvalFile reads the file in current system encoding of given interpreter:
      also if you "encoding system" returns here as example "cp1252" - your source file should be in "cp1252". 
      
      The multi byte <-> single byte (auto) translation can be a little bit different between 8.5 and 8.3. But i could not reproduce it, without more information, such platform, system encoding, file encoding, "init.tcl" loaded (or not), etc. 
      
      Otherwise, read the file in the "file encoding" with "Tcl_FSEvalFileEx": 
      
      Tcl_Obj *pathPtr = Tcl_NewStringObj("filename.tcl", -1);
      Tcl_IncrRefCount(pathPtr);
      ret = Tcl_FSEvalFileEx(interp, pathPtr, encodingName);
      Tcl_DecrRefCount(pathPtr);
      
      or by using of pure tcl:
      
      source -encoding "utf-8" "filename.tcl"
      
      
      
    2. login: "sebres"
    3. mimetype: "text/plain"
    4. username: "sebres"
  6. Ticket change [034f3675d7] (rid 119805) by dgp on 2012-02-08 04:36:32:

    1. icomment:
      What does [encoding system] return in your
      integrated scripting environment?
      
      My guess is that it returns "identity".
      
      This would indicate your program is
      failing to call Tcl_FindExecutable().
      True?
      
      Somewhere in the startup of your program
      add the call 
      
          Tcl_FindExecutable(NULL);
      
      (or, if you have the command line arguments
       of your program in an argv[] array, you can
       call
      
          Tcl_FindExecutable(argv[0]);
      
      )
      
      Then see if that makes your symptoms go away.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  7. Ticket change [0243b38422] (rid 119610) by dgp on 2012-04-19 23:08:29:

    1. closedate changed to: "2012-04-19T16:08:29"
    2. closer changed to: "dgp"
    3. status changed to: "Pending"
  8. Ticket change [5be015ecb4] (rid 118407) by dgp on 2012-06-05 21:00:44:

    1. closedate changed to: "2012-06-05T14:00:44"
    2. closer changed to: "dgp"
    3. icomment:
      
      
      allow_comments - 1
      
      
      
    4. login: "dgp"
    5. mimetype: "text/plain"
    6. status changed to: "Closed"
    7. username: "dgp"