Skip to content
Tcl Source Code View Ticket
Login

View Ticket

tcl can not eval multibyte strings

Closed / Invalid218305ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:55:56
OriginalBugID: 3669 Bug
Version: 8.2.2
SubmitDate: '1999-11-23'
LastModified: '2000-03-30'
Severity: LOW
Status: Closed
Submitter: techsupp
ChangedBy: hobbs
OS: BSD
OSVersion: tcl8.2.2
Machine: FreeBSD-3.3
FixedDate: '2000-10-25'
ClosedDate: '2000-03-30'


Name:
Taguchi Takeshi

Extensions:
plus patch for Tcl8.2.2

CustomShell:
I've made a tcl extension which determin Japanize encoding (detection engine come from SRA's Japanized

Comments:
i18n functions in tcl8.2 is not good enough.
But supporting it is a good news for us.
Please enhancement it.

ReproducibleScript:
# In the following example, file kanji.jis is a file which encoding is iso2022-jp.
# but I want to read as "binary string", and I want to analyze which encoding it is, and
# convert to system encoding manualy. but ......
set fp [open "kanji.jis"]
fconfigure $fp -encoding binary
set line [read $fp]
catch [list close $fp]

eval "set str $line" ; # <- produce error!

DesiredBehavior:
I think 
     eval $str
will be error. str contain something multibyte string, not system encoding.

This means all programmer and user must know script and its input/output encoding befor
evaluation.

But it is not good.
Imagin internet applications. the Internet is world wide. so programmer can not determin
user's encoding befor evaluation.



I'm not quite sure that the above is an error.  The user isn't
properly protecting the values against whitespace, as the
following example shows:

(tkcon) 49 % set line "a space here"
a space here
(tkcon) 50 % eval "set str $line"
wrong # args: should be "set varName ?newValue?"
(tkcon) 51 % eval [list set str $line]
a space here
 
-- 03/30/2000 hobbs
welch Closed ticket [218305ffff]. [History diff]2000-10-26 08:18:59
dgp Ticket [218305ffff]: 4 changes [History diff]2001-04-06 03:29:59
Log in (anonymous is fine) to add a comment.