Line feed representation of different operating systems

Source: Internet
Author: User

I believe that when you open some files in windows, the text is accumulated together and the sentences are filled with a black rectangle. In fact, this is a problem caused by different operating systems with different line breaks, I once wrote a simple small program to convert these files into a normal line feed file. The source code is available for you to download from the resource. So why is this problem? The following explains the cause.

A long time ago, old-fashioned telex typewriter was used as an input device.

Two characters to start a new line. One character moves the slide Frame back to the first place (called carriage return, <CR>), Another character moves a line (called line feed, <LF>).
After the advent of computers, memory was once very expensive. Some people think that there is no need to use two characters to represent the end of the line. Therefore, Unix developers decide that they can use <Line Feed>A character to indicate the end of a line. Apple developers have defined <CR>. Those who develop MS-DOS (and Microsoft Windows) decide to keep old-fashioned <CR> <LF>. The format of the end of the three rows is as follows:
UNIX <LF>
DoS <CR> <LF>
Mac <CR>
This means that if you try to move a file from one system to another, you have trouble with line breaks. UE troubles: every time you edit a file, you are prompted to convert it to DOS format

Cancel prompt

If your program needs to be in Unix/Linux in the future, it is best to maintain the Unix format.

Click "advanced"> "configuration"> "File Processing"> "dos/Unix/mac". Under the UNIX/MAC file detection/conversion on the right,

Disabled. Are you sure you want.

Two characters to start a new line. One character moves the slide Frame back to the first place (called carriage return, <CR>), Another character moves a line (called line feed, <LF>).
After the advent of computers, memory was once very expensive. Some people think that there is no need to use two characters to represent the end of the line. Therefore, Unix developers decide that they can use <Line Feed>A character to indicate the end of a line. Apple developers have defined <CR>. Those who develop MS-DOS (and Microsoft Windows) decide to keep old-fashioned <CR> <LF>. The format of the end of the three rows is as follows:
UNIX <LF>
DoS <CR> <LF>
Mac <CR>
This means that if you try to move a file from one system to another, you have trouble with line breaks. UE troubles: every time you edit a file, you are prompted to convert it to DOS format

Cancel prompt

If your program needs to be in Unix/Linux in the future, it is best to maintain the Unix format.

Click "advanced"> "configuration"> "File Processing"> "dos/Unix/mac". Under the UNIX/MAC file detection/conversion on the right,

Disabled. Are you sure you want.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.