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} {
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.
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,071 |
Nodes: | 10 (0 / 10) |
Uptime: | 87:09:55 |
Calls: | 13,755 |
Calls today: | 1 |
Files: | 186,984 |
D/L today: |
9,270 files (2,545M bytes) |
Messages: | 2,426,113 |