Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 27 |
Nodes: | 6 (0 / 6) |
Uptime: | 46:39:17 |
Calls: | 632 |
Calls today: | 3 |
Files: | 1,187 |
D/L today: |
24 files (29,813K bytes) |
Messages: | 176,485 |
I have issues with Tcl 9 reading a text file using:
set fid [open Profile.csv r]
set content [read $fid]
close $fid
I get following error:
error reading "file5b852c0": invalid or incomplete multibyte or wide character
Tcl 8 works.
I also tried reading the file line-by-line
while {[gets $fid line] >= 0} {
-a puts $line
}
but the error occures at first line.
I could not attach the file, Thunderbird complains about "non-binary distribution".
But I think the issue is the first char in this file, which might not be utf-8, not sure though.
On the other side, Tcl 8 could read the file.
I wonder if Tcl just got unrobust with version 9.
Regards
Alexandru
The issue is that the file is encoded in cp1252 instead utf-8.
I don't understand how this can lead to an error.
I expect wrong chars in the return value, but no error.
profile strictThank you for the hint.
Am 02.09.2025 um 03:04 schrieb et99:
profile strictThank you for the hint.
I'll add -profile tcl8 to my fconfigure commands.
Am 02.09.2025 um 04:03 schrieb meshparts:Of course, I do this anyway.
Am 02.09.2025 um 03:04 schrieb et99:
profile strictThank you for the hint.
I'll add -profile tcl8 to my fconfigure commands.
It is more constructive to add a "fconfigure -encoding".
This is also the case for 8.6.
Am 02.09.2025 um 08:03 schrieb Harald Oehlmann:
Am 02.09.2025 um 04:03 schrieb meshparts:Of course, I do this anyway.
Am 02.09.2025 um 03:04 schrieb et99:
profile strictThank you for the hint.
I'll add -profile tcl8 to my fconfigure commands.
It is more constructive to add a "fconfigure -encoding".
This is also the case for 8.6.
The issue is that I do "fconfigure -ecoding ut-8" by default but the
file is cp1252.
Now I have to do "fconfigure -ecoding ut-8 -profile tcl8" which I
assumed that it work, since it's not documented (see Ashok's Tcl/Tk
online documentation).
This seems to work as I get no error after this change.