AW: Writing file with accented chars as the decimal 131?

Karsten Kusche <[email protected]> Wed, 13 Dec 2023 15:44:32 +0000
Newsgroups gmane.comp.lang.smalltalk.vwnc
Message-ID <[email protected]>
Hi Giorgio,

when creating streams on files, always use the #withEncoding: constructor. It works with all kinds of encodings, specifically in your case #utf8. It even supports #binary as encoding, even though that’s no real encoding, but it makes it crystal clear what you can expect.

If you don’t use #withEncoding: then the encoding is always #default. This is a platform specific encoding that’s ms_cp_1252 in western Europe on Windows. On macOS and Linux it’s #utf8.

To use it simple send #withEncoding: to your filename, before sending a stream-construction message like #readStream or #writeStream:

(‘test’ asFilename withEncoding: #utf8) readStream

Kind Regards
Karsten

Von: [email protected] <[email protected]> Im Auftrag von giorgio ferraris
Gesendet: Mittwoch, 13. Dezember 2023 16:40
An: Visualworks Mailing List <[email protected]>
Betreff: [vwnc] Writing file with accented chars as the decimal 131?

Hello,
do you know how to write a file when the string includes accented characters,  quite common in European countries?

I get an "illegal character error "
.
I suppose using utf8 would do the trick but I didn't find how to do that. Missed the right place on the docs?

thanks a lot for suggestions

giorgio