Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 2d8bafa5af5ecde1697af51a2219a962538b781b7cc7cc14735a0563b69dc6b9
Ticket: b5cb29c639a5dab3b03e4d8827e7d4ab9b05ae61
utf-8 from&to and / binary encoding&decodeing conversation not the same
User & Date: anonymous on 2019-02-19 14:57:26
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed 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 changed to: "8.6.8"
  6. is_private changed to: "0"
  7. login: "anonymous"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "85671f894663f9e5da5ba6dfcadd8d477fe77a60"
  10. resolution changed to: "None"
  11. severity changed to: "Important"
  12. status changed to: "Open"
  13. submitter changed to: "anonymous"
  14. subsystem changed to: "- New Builtin Commands"
  15. title changed to: "utf-8 conversation"
  16. type changed to: "Bug"