Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
cppg
toBeTopJavaer
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
toBeTopJavaer
/
docs
/
basics
/
java-basic
/
UTF8-UTF16-UTF32.md
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
9 lines (5 loc) · 1.47 KB
master
Breadcrumbs
toBeTopJavaer
/
docs
/
basics
/
java-basic
/
UTF8-UTF16-UTF32.md
Copy path
Top
File metadata and controls
Code
Blame
9 lines (5 loc) · 1.47 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
Unicode
是容纳世界所有文字符号的国际标准编码
,
使用四个字节为每个字符编码
。
UTF
是英文
Unicode
Transformation
Format
的缩写
,
意为把
Unicode
字符转换为某种格式
。
UTF
系列编码方案
(
UTF
-
8
、
UTF
-
16
、
UTF
-
32
)
均是由
Unicode
编码方案衍变而来
,
以适应不同的数据存储或传递
,
它们都可以完全表示
Unicode
标准中的所有字符
。
目前
,
这些衍变方案中
UTF
-
8
被广泛使用
,
而
UTF
-
16
和
UTF
-
32
则很少被使用
。
UTF
-
8
使用一至四个字节为每个字符编码
,
其中大部分汉字采用三个字节编码
,
少量不常用汉字采用四个字节编码
。
因为
UTF
-
8
是可变长度的编码方式
,
相对于
Unicode
编码可以减少存储占用的空间
,
所以被广泛使用
。
UTF
-
16
使用二或四个字节为每个字符编码
,
其中大部分汉字采用两个字节编码
,
少量不常用汉字采用四个字节编码
。
UTF
-
16
编码有大尾序和小尾序之别
,
即
UTF
-
16
BE
和
UTF
-
16L
E
,
在编码前会放置一个
U
+
FEFF
或
U
+
FFFE
(
UTF
-
16
BE
以
FEFF
代表
,
UTF
-
16L
E
以
FFFE
代表
),
其中
U
+
FEFF
字符在
Unicode
中代表的意义是
ZERO
WIDTH
NO
-
BREAK
SPACE
,
顾名思义
,
它是个没有宽度也没有断字的空白
。
UTF
-
32
使用四个字节为每个字符编码
,
使得
UTF
-
32
占用空间通常会是其它编码的二到四倍
。
UTF
-
32
与
UTF
-
16
一样有大尾序和小尾序之别
,
编码前会放置
U
+
0000
FEFF
或
U
+
0000
FFFE
以区分
。
You can’t perform that action at this time.