<div dir="ltr">Thanks so much Bert! <br><br>I was pointing in the wrong direction ! I have changed the textedit preferences and it works perfectly.<br><br>All the best,<br> Javier<br><br><br><div class="gmail_quote">
On Mon, Sep 8, 2008 at 2:54 PM, Bert Freudenberg <span dir="ltr"><<a href="mailto:bert@freudenbergs.de">bert@freudenbergs.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Am 08.09.2008 um 14:15 schrieb Javier Reyes:<div><div></div><div class="Wj3C7c"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello All,<br>
I am using text morphs which may contain extended ascii characters (in my case spanish characters 'ñáéíóú'). When I save those morphs and bring them back to screen everything works fine. My problem comes when I write the morphs contents to a plain .txt file (which in my case has to be opened with TextEdit in Mac Osx). In that case the special characters are expanded into several.<br>
<br>
I am working with Squeak 3.9 in Mac OsX. I have tried UTF8TextConverter but I am obviously doing something wrong (My knowledge of this issue is really scarce) . My code can be sumarized with this snippet.<br>
<br>
<br>
tm := TextMorph new openInHand.<br>
(I write inside the morph some text contaning special chars, such as 'bañándose')<br>
<br>
(Then I write it to a file)<br>
utfString := (tm contents string) convertToWithConverter: (UTF8TextConverter new).<br>
aFile:= CrLfFileStream forceNewFileNamed: './myfile.txt'.<br>
aFile nextPutAll: utfString.<br>
aFile close.<br>
<br>
And that's it. When I open the file in TextEdit I get 'bañándose'. I have tried out some other bizarre strategies but they dont work either :-(<br>
<br>
Thanks very much for your help,<br>
</blockquote>
<br>
<br></div></div>
TextEdit tries to guess the encoding and often gets it wrong. You can set the encoding it uses in its preferences.<br>
<br>
And this code<br>
<br>
f := FileStream forceNewFileNamed: 'myfile.txt'.<br>
f nextPutAll: 'bañándose'.<br>
f close<br>
<br>
works just fine for me, it produces utf8-encoded text.<br>
<br>
(you should not use CrLfStream anymore)<br><font color="#888888">
<br>
- Bert -<br>
<br>
<br>
<br>
</font></blockquote></div><br></div>