Alexandru <
alexandr...@meshparts.de> wrote:
> Rich schrieb am Dienstag, 2. August 2022 um 21:16:27 UTC+3:
>> Alexandru <
alexandr...@meshparts.de> wrote:
>> > Recently I though it would be a good idea to add "encoding system
>> > utf-8" to my code.
>>
>> Overall, unless you are testing obscure things, it is probably best to
>> leave the system encoding alone.
>
> Thanks Rich for the explanation.
> I think Windows uses cp1252.
cp1252 is a font mapping, UTF-16 is an encoding - two different, but
related, items. Font mappings define what characters each integer
value represents (such as 65 meaning capital letter A in ASCII).
Encodings are how the integers are stored in memory (in the case of
UTF-16, as 16-bit integer values).
> So it's a mess: I write files typically in utf-8, read them back in
> utf-8.
Yep, and most new work really should be in UTF-8, unless you need
something else due to 'legacy'.
> All the application data is encoded in utf-8 although the system
> encoding is cp1252.
Again, that legacy stuff... :)
> E.g. when I use CAWT to read an Excel file, it's content is cp1252
> but somehow this still works?
Yes, because Tcl transparently converts it from cp1252 (and whatever
encoding it is stored in) for you.