Return symbol: Difference between revisions

From LemonWiki共筆
Jump to navigation Jump to search
mNo edit summary
Line 74: Line 74:
* [http://violin-tao.blogspot.tw/2016/05/crlflf-bug.html 陳雲濤的部落格: 筆記 CRLF跟LF之區別 --- 隱形的 bug]:「CRLF才是真正的打字機運作方式,你可以想像:打字機打到最右邊,要先return到最左邊之後,再往下一行,所以是CRLF ... ...」
* [http://violin-tao.blogspot.tw/2016/05/crlflf-bug.html 陳雲濤的部落格: 筆記 CRLF跟LF之區別 --- 隱形的 bug]:「CRLF才是真正的打字機運作方式,你可以想像:打字機打到最右邊,要先return到最左邊之後,再往下一行,所以是CRLF ... ...」
* [https://confluence.qps.nl/fledermaus/questions-answers/other/differences-in-end-of-line-characters-mac-windows-and-linux Differences in end of line characters Mac, Windows, and Linux]
* [https://confluence.qps.nl/fledermaus/questions-answers/other/differences-in-end-of-line-characters-mac-windows-and-linux Differences in end of line characters Mac, Windows, and Linux]
* [https://stackoverflow.com/questions/3059091/how-to-remove-carriage-returns-from-output-of-string php - How to remove carriage returns from output of string? - Stack Overflow]


References
References

Revision as of 09:22, 21 November 2018

換行符號 (Return symbol, line terminators, line endings, newline, end of line (EOL), line feed or line break)

  • On Win Os windows.png : CRLF = \r\n
  • On Unix, Linux Os linux.png & recent versions of macOS icon_os_mac.png : LF = \n
  • On classic versions of macOS icon_os_mac.png [1][2] e.g. Mac OS 9: CR = \r

如何看到換行符號

查看每一行使用的換行符號

  • Notepad++ On Win Os windows.png 選單 → 檢視 → 特殊字元 → 顯示行尾字元 (EOL)
  • RawLineEdit for Sublime text
    • 換行符號是 CRLF = \r\n 顯示的是 <0x0d>¬
    • 換行符號是 LF = \n 顯示的是 ¬ 象形符號 (glyph)
    • 換行符號是 CR = \r 顯示的是 <0x0d>
  • BASH cat command e.g. cat -e <filename>
    • 換行符號是 CRLF = \r\n 顯示的是 ^M$
    • 換行符號是 LF = \n 顯示的是 $
    • 換行符號是 CR = \r 顯示的是 ^M

查看檔案使用的換行符號

檔案內容 File command 偵測結果
換行符號是 CRLF = \r\n UTF-8 Unicode text, with CRLF line terminators
換行符號是 LF = \n UTF-8 Unicode text Icon_exclaim.gif
換行符號是 CR = \r UTF-8 Unicode text, with CR line terminators
特例: 換行符號夾雜 \r\n\r UTF-8 Unicode text, with CRLF, CR line terminators
特例: 換行符號夾雜 \r\n\n UTF-8 Unicode text, with CRLF, LF line terminators
特例: 換行符號夾雜 \n\r UTF-8 Unicode text, with CR, LF line terminators
特例: 無內容的空檔案 empty

如何取代換行符號

Related articles

References