Skip to content
Tcl Source Code History Of Ticket cae6ee6af19d2893
Login

History Of Ticket cae6ee6af19d2893

Artifacts Associated With Ticket cae6ee6af19d2893

  1. Ticket change [bc856de113] (rid 153906) by jgnemeth on 2017-05-23 15:57:53:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      I work under Windows 7, use ActiveTcl 8.6.4.1 for running and Notepad++ for writing TclTk scripts. Script files by default are utf-8 encoded without BOM. A simple program - located (say) in utf8test.tcl - demonstrates the problem.
      
      set fd [open <path_to_file>/utf8test.txt {RDWR CREAT TRUNC}]
      binary scan áéíöőúüűÁÉÍÖŐÚÜŰ H* du
      puts $fd $du
      close $fd; exit
      
      The hexeditor view of the script file
      
      00000000  73 65 74 20 66 64 20 5B 6F 70 65 6E 20 75 74 66  set fd [open utf
      00000016  38 74 65 73 74 2E 74 78 74 20 7B 52 44 57 52 20  8test.txt {RDWR 
      00000032  43 52 45 41 54 20 54 52 55 4E 43 7D 5D 0D 0A 0D  CREAT TRUNC}]...
      00000048  0A 62 69 6E 61 72 79 20 73 63 61 6E 20 C3 A1 C3  .binary scan áÃ
      00000064  A9 C3 AD C3 B6 C5 91 C3 BA C3 BC C5 B1 C3 81 C3  ©Ã.öőúüűÃ.Ã
      00000080  89 C3 8D C3 96 C5 90 C3 9A C3 9C C5 B0 20 48 2A  ‰Ã.ÖÅ.ÚÜŰ H*
      00000096  20 64 75 0D 0A 70 75 74 73 20 24 66 64 20 5C 6E   du..puts $fd \n
      00000112  24 64 75 0D 0A 0D 0A 63 6C 6F 73 65 20 24 66 64  $du....close $fd
      00000128  0D 0A 0D 0A                                      ....
      
      shows that the utf-8 representation of the test string is
      
      C3A1C3A9C3ADC3B6C591C3BAC3BCC5B1C381C389C38DC396C590C39AC39CC5B0
      
      Running the test script by double clicking on utf8test.tcl in the Windows Explorer window, however, produces the the hexadecimal string
      
      c3a1c3a9c3adc3b6c518c3bac3bcc5b1c381c330c38dc313c590c361c353c5b0
      
      Viewing the two string side by side
      
      C3A1C3A9C3ADC3B6 C591 C3BAC3BCC5B1C381 C389 C38D C396 C590 C39A C39C C5B0
      c3a1c3a9c3adc3b6 c518 c3bac3bcc5b1c381 c330 c38d c313 c590 c361 c353 c5b0
      
      reveals the problem that I have run up against while developing a much more complex application involving stmp, mime & http.
      
      There is another catch here. Run the script through the wish console. Even if you add 'fconfigure $fd -encoding utf-8' the result is
      
                  Q        q              P        p
      e1 e9 ed f6 51 fa fc 71 c1 c9 cd d6 50 da dc 70
      á  é  í  ö  ő  ú  ü  ű  Á  É  Í  Ö  Ő  Ú  Ü  Ű
      
      You have to apply 'encoding convertto utf-8' to the string then you achieve the desired result. The new script, however, won't work by click-and-run.
      
      You may now draw your conclusions.
      
      Thanks for any help
      
    5. foundin initialized to: "ActiveTcl 8.6.4.1"
    6. is_private initialized to: "0"
    7. login: "jgnemeth"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "b70ac307e27522f4d296a81696cf3ac44bc96fb6"
    10. resolution initialized to: "None"
    11. severity initialized to: "Important"
    12. status initialized to: "Open"
    13. submitter initialized to: "jgnemeth"
    14. subsystem initialized to: "44. UTF-8 Strings"
    15. title initialized to: "Errors in utf-8 encoding"
    16. type initialized to: "Bug"
  2. Ticket change [1999548776] (rid 169294) by jan.nijtmans on 2019-02-19 15:52:48:

    1. assignee changed to: "jan.nijtmans"
    2. closedate changed to: "2458534.16166704"
    3. closer changed to: "jan.nijtmans"
    4. icomment:
      The default "system encoding" on Windows is not UTF-8, so "fconfigure" is indeed the right thing to do.
      
    5. login: "jan.nijtmans"
    6. mimetype: "text/plain"
    7. resolution changed to: "Works For Me"
    8. status changed to: "Closed"