当前位置:网站首页>Utf8 encoding
Utf8 encoding
2022-07-05 06:32:00 【happytree001】
utf8 Coding is a way of coding that becomes , Minimum 1 byte , The longest 4 byte .

The following is python3.10.2 Middle to character utf8 Check function
/* Check whether the characters at s start a valid UTF-8 sequence. Return the number of characters forming the sequence if yes, 0 if not. */
static int valid_utf8(const unsigned char* s)
{
int expected = 0;
int length;
if (*s < 0x80)
/* single-byte code */
return 1;
if (*s < 0xc0)
/* following byte */
return 0;
if (*s < 0xE0)
expected = 1;
else if (*s < 0xF0)
expected = 2;
else if (*s < 0xF8)
expected = 3;
else
return 0;
length = expected + 1;
for (; expected; expected--)
if (s[expected] < 0x80 || s[expected] >= 0xC0)
return 0;
return length;
}
边栏推荐
- [leetcode] day94 reshape matrix
- 11-gorm-v2-03-basic query
- Game theory acwing 894 Split Nim game
- How to set the drop-down arrow in the spinner- How to set dropdown arrow in spinner?
- 求组合数 AcWing 887. 求组合数 III
- 微信小程序路由再次跳转不触发onload
- Game theory acwing 892 Steps Nim game
- 5.Oracle-錶空間
- What's wrong with this paragraph that doesn't work? (unresolved)
- MySQL advanced part 2: optimizing SQL steps
猜你喜欢

vsCode创建自己的代码模板

Knapsack problem acwing 9 Group knapsack problem

求组合数 AcWing 889. 满足条件的01序列

高斯消元 AcWing 884. 高斯消元解异或線性方程組

MPLS experiment

Design specification for mobile folding screen

Gaussian elimination acwing 884 Gauss elimination for solving XOR linear equations

Sorting out the latest Android interview points in 2022 to help you easily win the offer - attached is the summary of Android intermediate and advanced interview questions in 2022

How to make water ripple effect? This wave of water ripple effect pulls full of retro feeling

Series of how MySQL works (VIII) 14 figures explain the atomicity of MySQL transactions and the principle of undo logging
随机推荐
VLAN experiment
Stack acwing 3302 Expression evaluation
[Chongqing Guangdong education] 1185t administrative leadership reference test of National Open University in autumn 2018
【高德地图POI踩坑】AMap.PlaceSearch无法使用
Alibaba established the enterprise digital intelligence service company "Lingyang" to focus on enterprise digital growth
7.Oracle-表结构
背包问题 AcWing 9. 分组背包问题
Leetcode dynamic programming
Genesis builds a new generation of credit system
Dataframe (1): introduction and creation of dataframe
Client use of Argo CD installation
How to make water ripple effect? This wave of water ripple effect pulls full of retro feeling
4.Oracle-重做日志文件管理
There are three kinds of SQL connections: internal connection, external connection and cross connection
博弈论 AcWing 893. 集合-Nim游戏
Design specification for mobile folding screen
Sorting out the latest Android interview points in 2022 to help you easily win the offer - attached is the summary of Android intermediate and advanced interview questions in 2022
Series of how MySQL works (VIII) 14 figures explain the atomicity of MySQL transactions and the principle of undo logging
International Open Source firmware Foundation (osff) organization
How to generate an image from text on fly at runtime