当前位置:网站首页>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;
}
边栏推荐
- [wustctf2020] plain_ WP
- 【LeetCode】Easy | 20. Valid parentheses
- There are three kinds of SQL connections: internal connection, external connection and cross connection
- Ffmpeg build download (including old version)
- 【高德地图POI踩坑】AMap.PlaceSearch无法使用
- Leetcode dynamic programming
- Vant weave swipecell sets multiple buttons
- [learning] database: several cases of index failure
- Time is fast, please do more meaningful things
- H5 模块悬浮拖动效果
猜你喜欢
MySQL advanced part 2: the use of indexes
Find the combination number acwing 888 Find the combination number IV
P2575 master fight
Idea debug failed
Simple selection sort of selection sort
2. Addition and management of Oracle data files
SQL三种连接:内连接、外连接、交叉连接
Genesis builds a new generation of credit system
Interval problem acwing 906 Interval grouping
Client use of Argo CD installation
随机推荐
2022/6/29-日报
[Chongqing Guangdong education] 1185t administrative leadership reference test of National Open University in autumn 2018
RecyclerView的应用
Winter vacation water test 1 Summary
LeetCode-61
PR automatically moves forward after deleting clips
4.Oracle-重做日志文件管理
博弈论 AcWing 894. 拆分-Nim游戏
Vant weave swipecell sets multiple buttons
SQL三种连接:内连接、外连接、交叉连接
11-gorm-v2-03-basic query
2021apmcm post game Summary - edge detection
微信小程序路由再次跳转不触发onload
在新线程中使用Handler
求组合数 AcWing 889. 满足条件的01序列
June 29, 2022 daily
高斯消元 AcWing 884. 高斯消元解异或线性方程组
Game theory acwing 891 Nim games
AE tutorial - path growth animation
Leetcode divide and conquer / dichotomy