[squeak-dev] Survey | Default encoding for new (multi-byte) file streams

Marcel Taeumel marcel.taeumel at hpi.de
Mon Apr 11 12:42:12 UTC 2022

Hi all --

What do you think should be the default encoding when opening a new file?

FileStream readOnlyFileNamed: 'foo' do: [:stream | stream contents].

They are system/platform-specific for now, but effectively utf-8 on many (if not most?) platforms. The original idea seemed to be that platform files could be opened without hassle. By now, everybody expects utf-8, especially when preparing files for the Web or other external, os-independent storage. However, there are platforms (and maybe even working VM versions) where this may not be true.

See Latin1Environment class >> #systemConverterClass to get an idea about what can be special about a platform's converter.

Note that you can always make it explicit:

FileStream readOnlyFileNamed: 'foo' do: [:stream |
   stream converter: UTF8TextConverter new.   
   stream contents].

(This is not about Squeak's code files .st .cs .changes .source, which are utf-8 by default already.)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220411/bb54e3f2/attachment.html>

More information about the Squeak-dev mailing list