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

giorgio ferraris <[email protected]> Wed, 13 Dec 2023 16:50:05 +0100
Newsgroups gmane.comp.lang.smalltalk.vwnc
Message-ID <CAD8yvAyqiqOQnA5xsh=Ot=EXO0RxpdzxHzu5WXq0eJbrLRs=ew@mail.gmail.com>
hello Karsten,

 I was sending withEncoding: too late....
Just for info, from what I have seen, on OSX Apple Silicon the standard
writeStream seems to be #binary, not  #default.

thanks a lot

ciao

giorgio

On Wed, Dec 13, 2023 at 4:44 PM Karsten Kusche <[email protected]> wrote:

> 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
>
>
>