Python学习笔记 --- utf-8与utf-8-sig 两种编码格式区别
2016-09-27 15:06
501 查看
As UTF-8 is an 8-bit encoding no BOM is required and anyU+FEFF character in the decoded Unicode string
(even if it’s the firstcharacter) is treated as a ZERO WIDTH NO-BREAK SPACE.
UTF-8以字节为编码单元,它的字节顺序在所有系统中都是一様的,没有字节序的问题,也因此它实际上并不需要BOM(“ByteOrder Mark”), 但是UTF-8 with BOM即utf-8-sig需要提供BOM("ByteOrder
Mark")。
具体解释:
(even if it’s the firstcharacter) is treated as a ZERO WIDTH NO-BREAK SPACE.
UTF-8以字节为编码单元,它的字节顺序在所有系统中都是一様的,没有字节序的问题,也因此它实际上并不需要BOM(“ByteOrder Mark”), 但是UTF-8 with BOM即utf-8-sig需要提供BOM("ByteOrder
Mark")。
具体解释:
Python 'utf-8-sig' Codec This work similar to UTF-8 with the following changes: * On encoding/writing a UTF-8 encoded BOM will be prepended/written as the first three bytes. * On decoding/reading if the first three bytes are a UTF-8 encoded BOM, these bytes will be skipped.
相关文章推荐
- Python中utf-8与utf-8-sig两种编码格式的区别
- Python学习笔记之疑问 6:#coding=utf-8 与#-*- coding: utf-8 -*-的区别
- python学习笔记 --- 实现将文件转换编码为utf-8-sig(带BOM)
- UNICODE,GBK,UTF-8:编码格式的区别
- [python学习笔记]'i += x'和'i = i + x'的区别
- Python学习笔记 - 字符串和编码
- UTF-8编码格式与Unicode编码格式学习
- python 学习笔记 -- python 2.X 和 3.X的区别及如何选择
- NetworkX学习笔记-3-Python中输出Gephi文件格式的方法
- html学习笔记--常见图片格式区别
- c++学习笔记之c/c++两种语言初始化变量区别
- python3.4学习笔记(四) 3.x和2.x的区别,持续更新
- python学习笔记1--python中编码的重要性
- Python学习笔记(三)input和raw_input的区别
- iOS音频学习笔记一:常见音频封装格式及编码格式
- Python 学习笔记: id(), ==, is 之间的区别
- python学习笔记一(python 编码)
- Python 编码知识学习笔记
- python学习笔记30(全局变量的两种解决办法)