dl
dl::CodeCvt::Utf8 命名空间参考

utf8编码 更多...

函数

int Check (std::string_view str)
 返回是否是utf-8编码
 
size_t Sub (std::string_view str, size_t max)
 utf-8的子串计算
 
void Copy (char *target, size_t size, std::string_view source, bool show_log=true)
 utf-8的安全复制
 

详细描述

utf8编码

函数说明

◆ Check()

int dl::CodeCvt::Utf8::Check ( std::string_view str)

返回是否是utf-8编码

返回值
0mb
1ascii(也算utf8编码)
2utf-8

◆ Copy()

void dl::CodeCvt::Utf8::Copy ( char * target,
size_t size,
std::string_view source,
bool show_log = true )

utf-8的安全复制

参数
[out]target目标缓冲区
[in]size目标缓冲区大小
[in]source源字符串
[in]log是否输出日志,在源字符串过大时

◆ Sub()

size_t dl::CodeCvt::Utf8::Sub ( std::string_view str,
size_t max )

utf-8的子串计算

参数
[in]str源字符串
[in]max最大长度
返回值
返回应该截断的位置