Java checks the type of OS where it is currently working on, and switches the binary representation of “\n”. This line writes a 0x0A on Mac, but it will (though I haven’t tested it) writes “0x0D 0x0A” on Windows. LF: Normalizing Line Endings in Git | Aleksandr Hovhannisyan I found an interesting article about the history of CR+LF vs LF: Text editors translates 0x0A into 0x0D 0x0A.Īlso, Git has an optional feature that, on Windows, it translates all CR LF (new line in Windows style) in files into LF (Unix style) when you commit changes into git repository. Windows wants (perhaps) a new line to be 2 bytes of CRLF. Therefore any text editors on Mac translate 0x0D 0x0A into 0x0a. Mac wants a new line to be a single LF (0x0A). However, a “new line” in files is OS-dependent due to a historical reason. Protocol defines it regardless which type of OS/application is generating/consuming messages across network. In the networking domain, a “new line” must be represented by a fixed byte sequence (0x0D 0x0A). Here the doc mentions CRLF (0x0D 0x0A in hex) should be used as line separator in Email messages on the fly. (The carriage-return/line-feed pair is usually written in this document as “CRLF”.) A line is a series of characters that is delimited with the two characters carriage-return and line-feed that is, the carriage return (CR) character (ASCII value 13) followed immediately by the line feed (LF) character (ASCII value 10). Messages are divided into lines of characters. Should start with studying the specification of Email message format.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |