lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Different platforms use different definitions for new line.

unix/linux = LF
windows = CRLF
mac = CR

Kenneth

bidong liao wrote:
but why? different platforms got different results(mac got CRLF but windows
got CRCRLF)?

On Thu, Nov 19, 2009 at 5:38 PM, Philippe Lhoste <PhiLho@gmx.net> wrote:

On 19/11/2009 05:52, Roger Ivie wrote:

Yes. When you open in text mode, "\n" is written as CRLF instead of LF.
That's what text mode means.

In text mode, when you write "\r\n", it is written as CRCRLF. The first
CR is for the "\r" and the CRLF is for the "\n".

Aha, good answer! Obvious in retrospect... It explains why sometime I get
files with double line spacing with this curious CRCRLF scheme. And why one
should use the system-agnostic \n line ending: even if that's what is
written raw in the file, only the brain-dead Notepad won't understand it...
:-)

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --