<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><br></div><div class="gmail_quote">On Thu, Aug 14, 2014 at 8:30 AM, Levente Uzonyi <span dir="ltr">&lt;<a href="mailto:leves@elte.hu" target="_blank">leves@elte.hu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="">On Wed, 13 Aug 2014, Chris Cunningham wrote:</div>
</blockquote><div>[snip] </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

MultiByteFileStream changes:<br>
- assume that wantsLineEndConversion is properly initialized<br>
- removed the line end conversion code from #nextPut:<br>
<br>
Levente, do you happen to remember why you made MultiByteFileStream&gt;&gt;nextPut: not do the line end conversion code 3 years ago?<br>
</blockquote>
<br></div>
Because line end conversion is also done by the TextConverter (see<br>
#<u></u>installLineEndConventionInConv<u></u>erter), so it created double line endings<br>
(cr -&gt; crlf -&gt; crlflf) in some cases, and it was unnecessary anyway.<br>
<br>
I just checked if it works, and it does on linux:<br>
<br>
| filename result |<br>
filename := UUID new asString36, &#39;.txt&#39;.<br>
FileStream newFileNamed: filename do: [ :file |<br>
        file<br>
                lineEndConvention: #crlf;<br>
                nextPut: Character cr;<br>
                nextPutAll: String cr;<br>
                lineEndConvention: #lf;<br>
                nextPut: Character cr;<br>
                nextPutAll: String cr;<br>
                lineEndConvention: #cr;<br>
                nextPut: Character cr;<br>
                nextPutAll: String cr;<br>
                lineEndConvention: nil;<br>
                nextPut: Character cr;<br>
                nextPutAll: String cr ].<br>
result := FileStream readOnlyFileNamed: filename do: [ :file | file binary upToEnd ].<br>
FileDirectory default deleteFileNamed: filename.<br>
self assert: result = #[13 10 13 10 10 10 13 13 13 13]<br>
<br>
Does it work on your machine?<br>
<br></blockquote><div>Yes, I get the same results on my system.  It appears to work just fine IF you tell the file each time that you open it what line ending you want. So the mechanism works.</div><div><br></div><div>If you let it default, however, it does not conversion at all:</div>
<div><div><br></div><div>| filename result |</div><div>filename := UUID new asString36, &#39;.txt&#39;.</div><div>FileStream newFileNamed: filename do: [ :file |</div><div>        file</div><div>                nextPut: Character cr;</div>
<div>                nextPutAll: String cr ].</div><div>result := FileStream readOnlyFileNamed: filename do: [ :file | file binary upToEnd ].</div><div>FileDirectory default deleteFileNamed: filename.</div><div>self assert: result = #[13 13]</div>
</div><div><br></div><div>( I assume you get the same, right?)</div><div><br></div><div>There seem to be at least three things wrong that I see:</div><div>1. Determine the right default line endings by platform isn&#39;t happening.  (something is going wrong with the startUp code, at least for MultiByteFileStream).</div>
<div>2. The variable wantsLineEndConversion is not set.</div><div>3. The variable lineEndConvention is not set etiher.</div><div>I think these need to be fixed.  When these aren&#39;t set, it doesn&#39;t install anything in the converter.</div>
<div><br></div><div><div>| filename |</div><div>filename := UUID new asString36, &#39;.txt&#39;.</div><div>FileStream newFileNamed: filename do: [ :file |</div><div>        self </div><div><span class="" style="white-space:pre">                </span>assert: file converter notNil;</div>
<div><span class="" style="white-space:pre">                </span>assert: file wantsLineEndConversion;</div><div><span class="" style="white-space:pre">                </span>assert: file lineEndConvention notNil.</div><div><span class="" style="white-space:pre">        </span>].</div>
<div>FileDirectory default deleteFileNamed: filename.</div></div><div><br></div><div>And, Levente, thank you for the resopnse, this helps.</div><div><br></div><div>-cbc</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<br>
Levente<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><br></div></blockquote></blockquote>
</div></div></div>