背景
在不同操作系统中,会使用不同的换行符来表示换行。
含义
换行符包括 "回车"(carriage return)和 "换行"(line feed)。
默认情况下,Macintosh 系统(早期的 Mac OS)则使用 <回车>
(CR),即 \r
(用十六进制表示:0D)。
在 Unix 和较新的 Mac 系统(指在早期的 Mac OS 基础上,更换了内核后的 Mac 系统,包含最新的 macOS 和 MacOSX)中,每行的结尾只有 <换行>
(LF),即 \n
(用十六进制表示:0A)。
而
在 Windows 中,每行结尾是 <回车><换行>
(CRLF),即 \r\n
(用十六进制表示:)。
这里的 “默认情况” 是指用户在该系统下,使用系统自带的文本编辑器,自动生成的换行表示符。
然而,我们如果使用 Sublime Text
、Notepad++
等第三方文本编辑器,可以修改默认表示换行符的方式。
如,Sublime
中,在 Setting-User
中设置 "default_line_ending":"unix"
。
Reference
FEATURED TAGS
algorithm
algorithmproblem
architecturalpattern
architecture
aws
c#
cachesystem
codis
compile
concurrentcontrol
database
dataformat
datastructure
debug
design
designpattern
distributedsystem
django
docker
domain
engineering
freebsd
git
golang
grafana
hackintosh
hadoop
hardware
hexo
http
hugo
ios
iot
java
javaee
javascript
kafka
kubernetes
linux
linuxcommand
linuxio
lock
macos
markdown
microservices
mysql
nas
network
networkprogramming
nginx
node.js
npm
oop
openwrt
operatingsystem
padavan
performance
programming
prometheus
protobuf
python
redis
router
security
shell
software testing
spring
sql
systemdesign
truenas
ubuntu
vmware
vpn
windows
wmware
wordpress
xml
zookeeper