[Gambas-user] Non-linux line ending files are seen as binary by the IDE

Rolf-Werner Eilert eilert-sprachen at ...221...
Tue Feb 3 13:28:49 CET 2015



Am 03.02.2015 13:12, schrieb Benoît Minisini:
> Le 03/02/2015 12:45, Rolf-Werner Eilert a écrit :
>> I observed that Win7 tends to add some kind of flag byte(s) at the
>> beginning of the file when it's UTF-8 (under VB).
>
> Yes, this is one of the (many) design failures of windows.
>
>>
>> Otherwise, I have solved the problem in one of my programs that must
>> write UTF-8 files for a Win (VB) and Linux (Gambas) client, by adding a
>> CR+LF at the end of each line when writing in Gambas and then Trim()
>> each line when reading the files. The VB client, of course, can just
>> read and write as it's used to do.
>
> The 'Line Input' instruction can deal with any end-of-line sequence
> (Linux, Mac & Windows).
>
> See the Stream.EndOfLine property. Its value can be:
>
> - gb.Windows: the end-of-line sequence is "\r\n".
> - gb.Mac: the end-of-line sequence is "\r".
> - gb.Unix: the end-of-line sequence is "\n" (*or* "\r\n" on reading).
>
> Note that gb.Unix allows you to read both Unix and Windows format, but
> only write Unix format.
>
> Regards,
>

Great thing, Benoit, didn't realize it was there. Sometimes one should 
read the documentation more carefully ;)

But my above example related to an older generation of software 
developed under Gambas2.

Rolf




More information about the User mailing list