Transferred from Captain log
In text processing, CR, LF, CR/LF are linefeeds used on different operating systems.
Dos and windows use carriage return + line feed CR/LF to represent the next line,
In UNIX/Linux, the line break LF indicates the next line,
The mac OS system uses the carriage return (CR) to indicate the next line.
CR is represented by the 'R' symbol. the ASCII code in decimal format is 13 and the hexadecimal code is 0x0D;
LF uses the 'N' symbol, the ASCII code is 10, and the hexadecimal value is 0x0A.
Therefore, on Windows, line breaks are represented by 0d 0a in text files, while on UNIX and Apple platforms, line breaks are represented by 0a or 0d in one byte.
Generally, the Runtime library on the operating system automatically determines the line feed format of text files. for example, if a program runs on windows, a text file in CR/LF line feed format is generated, and a text file in LF format is generated when it runs on Linux.
Using another line break file on one platform may cause unexpected problems, especially when editing program code. sometimes the code is displayed normally in the editor, but an error occurs due to line breaks during editing.
Many text/code Editors Use the line break Conversion Function to swap line breaks in text files in different formats.
When FTP software is used to transfer files between different platforms, some FTP client programs automatically convert the line feed format in ascii text transmission mode. the number of bytes transmitted may change. if you do not want to modify the original file via ftp, you can use bin mode (binary mode) to transfer text.