Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: dae787ef94dd2ee4121df0c2906fe3a41f6e3c1f27d1ef80ea3cef2f20422bc9
Ticket: 9f9c828fde97a4c8a7a528dec3482ecce0838419
trim issue with chinese characters
User & Date: anonymous on 2024-11-06 14:03:41
Changes

  1. icomment:
    Using the following code:
    
    puts "Encoding: [encoding system]"
    set comment "测试包装"
    
    puts [lmap c [split $comment ""] {scan $c %c}]
    puts $comment
    set comment [string trim $comment]
    puts [lmap c [split $comment ""] {scan $c %c}]
    puts $comment
    
    
    Running on command line the output is this:
    ./test_chinese.tcl
    Encoding: utf-8
    27979 35797 21253 35013
    测试包装
    27979 35797 21253 35013
    测试包装
    
    
    Running from CGI webpage:
    
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <meta charset="UTF-8">
    </head>
    <body>
    Encoding: iso8859-1
    230 181 139 232 175 149 229 140 133 232 163 133
    测试包装
    230 181 139 232 175 149 229 140 133 232 163
    测试包�
    ...
    </body>
    </html>
    
    
    ########
    
    It's related to encoding handling, the file is saved as UTF-8 but going through Apache. I will check Apache documentation and will update after.
    
  2. login: "anonymous"
  3. mimetype: "text/plain"