当前位置:网站首页>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;
}
边栏推荐
- 容斥原理 AcWing 890. 能被整除的数
- H5 模块悬浮拖动效果
- 【LeetCode】Easy | 20. Valid parentheses
- VLAN experiment
- Redis-02.Redis命令
- Nested method, calculation attribute is not applicable, use methods
- 'mongoexport 'is not an internal or external command, nor is it a runnable program or batch file.
- [2020]GRAF: Generative Radiance Fields for 3D-Aware Image Synthesis
- 2048项目实现
- Presentation of attribute value of an item
猜你喜欢

Day 2 document

MySQL怎么运行的系列(八)14张图说明白MySQL事务原子性和undo日志原理

NotImplementedError: Cannot convert a symbolic Tensor (yolo_boxes_0/meshgrid/Size_1:0) to a numpy ar

什么是套接字?Socket基本介绍

将webApp或者H5页面打包成App

Redis-01.初识Redis

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

LeetCode-54

1.手动创建Oracle数据库

背包问题 AcWing 9. 分组背包问题
随机推荐
Bash exercise 17 writing scripts to install the server side of FRP reverse proxy software
[learning] database: MySQL query conditions have functions that lead to index failure. Establish functional indexes
LeetCode-61
Nested method, calculation attribute is not applicable, use methods
VLAN experiment
Chinese remainder theorem acwing 204 Strange way of expressing integers
[2020]GRAF: Generative Radiance Fields for 3D-Aware Image Synthesis
Time is fast, please do more meaningful things
LeetCode-54
[learning] database: several cases of index failure
1. Create Oracle database manually
Alibaba established the enterprise digital intelligence service company "Lingyang" to focus on enterprise digital growth
11-gorm-v2-03-basic query
Record of problems in ollvm compilation
LSA Type Explanation - lsa-1 [type 1 LSA - router LSA] detailed explanation
Using handler in a new thread
FFmpeg build下载(包含old version)
[Chongqing Guangdong education] National Open University 2018 autumn 0702-22t contemporary Chinese political system reference questions
微信小程序路由再次跳转不触发onload
[2021]IBRNet: Learning Multi-View Image-Based Rendering Qianqian