Hello again.

I've changed default system encoding to iso8859-2. Here's my small
script:

<+
# reading 'test.txt' from a file (converted to Utf-8)
set f [open test.txt r]
set fc [string toupper [read $f]]
close $f
puts "$fc<BR>\n"
hputs "$fc<BR>\n"

# contents of 'test.txt' - set manually
set fc [string toupper "±æê³ñ󶼿"]
puts "$fc<BR>\n"
hputs "$fc<BR>\n"
hputs "<BR>\nencoding=[encoding system]\n"
+>

test.txt contains some smallcase polish fonts...

When I read the text from a file puts prints it correctly while hputs
does not - I suppose hputs does not use UtfToExternal() which puts does
( in generic/tclIO.c/WriteChars() ). When using puts all characters are
uppercase.

When I set it manually (using 'set fc ...') hputs prints it almost
correctly, puts however does not. Almost because some chars are
uppercase and some are not.

It seems to me that read->puts converts strings to Utf, then uppercases
them and converts back to iso8859-2. When I do set->hputs however, they
remain in iso8859-2 form, not Utf-8. So these two combinations work with
eachother, but when reading polish strings from a file some chars they
get messed up.

I realize it's a sad thing, but I suppose some (most/every?) functions
should be rewritten using UtfToExternal/ExternalToUtf... Anybody has
another idea?

-- 
Wojciech Kocjan
email: [EMAIL PROTECTED]
tel:   +48-501-778778

PGP signature

Reply via email to