done https://pharo.fogbugz.com/default.asp?13314 2014-06-06 21:41 GMT+02:00 Sven Van Caekenberghe <sven@stfx.eu>:
On 06 Jun 2014, at 21:23, Nicolai Hess <nicolaihess@web.de> wrote:
Workspace>>#saveString:toFile: ( or FileStream) behaves differently for arguments of type ByteString and Text. ByteString is used by "Save as" Text is used by accept.
Great catch !
Maybe the easiest fix is to do a #asString before doing the nextPutAll: in #saveString:toFile: - way easier than figuring out the mess of MultiByteFileStream.
Reproduceable with:
|fileone filetwo text str| text:='hello world' asText. str:='hello world'. fileone:='text1.txt'. filetwo:='text2.txt'. FileStream forceNewFileNamed: fileone do: [ :stream | stream converter: (TextConverter newForEncoding: 'utf-8'). stream wantsLineEndConversion: true. stream lineEndConvention: #crlf. stream nextPutAll: text ].
FileStream forceNewFileNamed: filetwo do: [ :stream | stream converter: (TextConverter newForEncoding: 'utf-8'). stream wantsLineEndConversion: true. stream lineEndConvention: #crlf. stream nextPutAll: str ].
2014-06-06 20:06 GMT+02:00 Sven Van Caekenberghe <sven@stfx.eu>: I looked at the Workspace code a bit, but just by looking at it, I can't find anything wrong. Everything (look at the senders) goes through Workspace>>#saveString:toFile: which uses both the chosen encoding and line end convention.
But I have also not yet tried to reproduce the problem.
On 06 Jun 2014, at 19:30, phil@highoctane.be wrote:
Look at the top right arrow-style men in the window of the workspace, there are also some checkboxes in there related to line endings... (near the end).
Phil
On Fri, Jun 6, 2014 at 6:02 PM, stepharo <stepharo@free.fr> wrote: enter a bug entry.
On 5/6/14 19:16, Esteban A. Maringolo wrote: When working in a Workspace, if I choose to save using Ctrl+S, the file will have Mac EOL (getting a lot of ^M characters when viewed using less or vim), if I choose "Save As" it saves the file "properly" (as expected).
I guess this is a Bug, but maybe its not.
Regards!
Esteban A. Maringolo