[Pharo-project] Write accentuate characters in file

Damien Cassou damien.cassou at gmail.com
Mon May 16 17:10:33 CEST 2011


On Mon, May 16, 2011 at 5:01 PM, Henrik Sperre Johansen
<henrik.s.johansen at veloxit.no> wrote:
> FileStream newFileNamed: 'test.txt' do: [ :stream |
>     stream converter: MacRomanTextConverter new; " or: TextConverter
> newForEncoding: 'mac-roman' "
>     nextPutAll: 'ééé' ].

This is the correct way of solving your problem... however, your
application becomes dependent of MacOS X. If you want your application
to be portable to other OSes, I would advise you to use the simple
approach that you give

FileStream newFileNamed: 'test.txt' do: [ :each | each nextPutAll: 'ééé' ]

and tell your favorite Apple editor that this is indeed UTF-8. UTF-8
is the standard, MacRoman is Apple only.

-- 
Damien Cassou
http://damiencassou.seasidehosting.st

"Lambdas are relegated to relative obscurity until Java makes them
popular by not having them." James Iry



More information about the Pharo-project mailing list