Skip to content
Tcl Source Code History Of Ticket b5cb29c639a5dab3
Login

History Of Ticket b5cb29c639a5dab3

Artifacts Associated With Ticket b5cb29c639a5dab3

  1. Ticket change [2d8bafa5af] (rid 169290) by anonymous on 2019-02-19 14:57:26:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      this string "Vašco da Gama äüö € é" cannot be preserved by converting or base64.
      
      --------------------------------------------
      testcode output
      --------------------------------------------
      tcl_platform(byteOrder)     = littleEndian
      tcl_platform(engine)        = Tcl
      tcl_platform(machine)       = x86_64
      tcl_platform(os)            = Linux
      tcl_platform(osVersion)     = 4.1.12-94.2.1.el6uek.x86_64
      tcl_platform(pathSeparator) = :
      tcl_platform(platform)      = unix
      tcl_platform(pointerSize)   = 4
      tcl_platform(threaded)      = 1
      tcl_platform(user)          = tbasien
      tcl_platform(wordSize)      = 4
      8.6.8
      Vašco da Gama äüö € é (Va\u0161co da Gama \u00E4\u00FC\u00F6 \u20AC \u00E9)
      Vaaco da Gama äüö ¬ é (Vaaco da Gama \u00E4\u00FC\u00F6 \u00AC \u00E9)
      Vaaco da Gama äüö ¬ é (Vaaco da Gama \u00C3\u00A4\u00C3\u00BC\u00C3\u00B6 \u00C2\u00AC \u00C3\u00A9)
      Vaaco da Gama äüö ¬ é (Vaaco da Gama \u00C3\u00A4\u00C3\u00BC\u00C3\u00B6 \u00C2\u00AC \u00C3\u00A9)
      
      
      --------------------------------------------
      testcode
      -------------------------------------------
      proc u2x s {
          set res {} 
          foreach c [split $s {}] {
              scan $c %c int
              append res [expr {$int<128? $c :"\\u[format %04.4X $int]"}]
          }
          set res
      }
      proc p {s} {
       puts "$s ([u2x $s])"
      }
      
      encoding system utf-8
      parray tcl_platform
      puts $tcl_patchLevel
      
      # Va\u0161co da Gama \u00E4\u00FC\u00F6 \u20AC \u00E9
      # this string is utf-8
      set i  "Vašco da Gama äüö € é"
      
      # this conventions do not end in the same as the input string
      set a [binary decode base64 [binary encode base64 $i]]
      set b [encoding convertto utf-8 [encoding convertfrom utf-8 $i]]
      set c [encoding convertto utf-8 [binary decode base64 [binary encode base64 [encoding convertfrom utf-8 $i]]]]
      p $i
      p $a
      p $b
      p $c
      
    5. foundin initialized to: "8.6.8"
    6. is_private initialized to: "0"
    7. login: "anonymous"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "85671f894663f9e5da5ba6dfcadd8d477fe77a60"
    10. resolution initialized to: "None"
    11. severity initialized to: "Important"
    12. status initialized to: "Open"
    13. submitter initialized to: "anonymous"
    14. subsystem initialized to: "- New Builtin Commands"
    15. title initialized to: "utf-8 conversation"
    16. type initialized to: "Bug"
  2. Ticket change [effc660196] (rid 169291) by jan.nijtmans on 2019-02-19 15:27:40:

    1. icomment:
      Looks like the "encoding convertto" and "encoding convertfrom" are interchanged. See: [950acd6df4cffdac6dfecd189864e86262c33ea5] for an explanation why.
      
      Closing as invalid
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  3. Ticket change [a8aaea2f18] (rid 169292) by jan.nijtmans on 2019-02-19 15:27:53:

    1. closedate changed to: "2458534.14436565"
    2. closer changed to: "jan.nijtmans"
    3. login: "jan.nijtmans"
    4. mimetype: "text/plain"
    5. resolution changed to: "Invalid"
    6. status changed to: "Closed"
  4. Ticket change [4f55201549] (rid 169295) by anonymous on 2019-02-19 16:48:43:

    1. closer changed to: "nobody"
    2. icomment:
      I saw the article mention. But cannot really match this. So I reopend that for further comments.
      
      I am wondering, that a binary encoding/decodeing ends indifferent results.
      
          set a [binary decode base64 [binary encode base64 $i]]
      
      Will we not expect, that {$a eq $i}?
      
      I edit the headline for that ticket to make it more clear.
      
    3. login: "anonymous"
    4. mimetype: "text/plain"
    5. status changed to: "Open"
    6. title changed to:
      utf-8 from&to and / binary encoding&decodeing conversation not the same
      
    7. username: "[email protected]"
  5. Ticket change [9cdb9d5d4f] (rid 169337) by bll on 2019-02-21 16:09:07:

    1. icomment:
      You cannot do a direct conversion of the Tcl internal representation.
      
      % set i  "Vašco da Gama äüö € é"
      Vašco da Gama äüö € é
      
      % set f [binary encode base64 $i]
      VmFhY28gZGEgR2FtYSDk/PYgrCDp
      % set g [binary decode base64 $f]
      Vaaco da Gama äüö ¬ é
      
      % set q [encoding convertto utf-8 $i]
      Vašco da Gama äüö € é
      % set f [binary encode base64 $q]
      VmHFoWNvIGRhIEdhbWEgw6TDvMO2IOKCrCDDqQ==
      % set g [binary decode base64 $f]
      Vašco da Gama äüö € é
      % set h [encoding convertfrom utf-8 $g]
      Vašco da Gama äüö € é
      %
      
    2. login: "bll"
    3. mimetype: "text/plain"
  6. Ticket change [c37cc107ef] (rid 169338) by oehhar on 2019-02-22 10:05:44:

    1. icomment:
      Dear amitego,
      
      you need binary data (bytes) for "binary encode base64".
      If you feed-in non-ninary data, the result is undefined.
      
      Lets take the string "ä".
      This is one character of the unicode codepoint \u00e4. By chance, the value is below \u00ff, so a conversion to binary does not harm and the character passes.
      
      Lets take the character "š".
      This is one character of the unicode codepoint \u0161.
      If this is treated as binary, only the lower byte is retained.
      This results in \u0061 which corresponds to the character "a".
      
      You observe this transformation in your example.
      
      To transform a string into binary data, an encoding is required.
      If you choose "utf-8", you get:
      
      <verbatim>
      % set u [encoding convertto utf-8 š]
      Å¡
      % string length $u
      2
      % scan $u %c%c
      197 161
      </verbatim>
      
      This representation may be used by binary encode.
      
      I hope, it is getting clearer what happens.
      It is difficult but very powerful.
      
      Hope this helps,
      Harald
      
    2. login: "oehhar"
    3. mimetype: "text/x-fossil-wiki"
    4. username: "oehhar"
  7. Ticket change [d3aaf3ff17] (rid 170650) by dgp on 2019-04-01 15:09:01:

    1. closedate changed to: "2458575.13127183"
    2. closer changed to: "dgp"
    3. login: "dgp"
    4. mimetype: "text/plain"
    5. status changed to: "Closed"