c++ - 检测多字节字符编码

标签 c++ c character-encoding pattern-matching

有哪些 C/C++ 库可以检测字符数组 (char*) 的多字节字符编码(UTF-8、UTF-16 等)。一个好处是还可以检测匹配器何时停止,即检测给定的一组可能编码的前缀匹配范围。

最佳答案

ICU 做 character set detection .您必须注意,正如 ICU 文档所述:

This is, at best, an imprecise operation using statistics and heuristics. Because of this, detection works best if you supply at least a few hundred bytes of character data that's mostly in a single language.

关于c++ - 检测多字节字符编码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7836490/

相关文章:

c - 如何为特定功能禁用堆栈金丝雀?

ruby-on-rails - 您将如何为 `Iconv.new("UTF8//IGNORE", ...)` 习语编写测试?

c - pthread执行陷入无限循环

c++ - 错误 : strstream. h:没有那个文件或目录

c++ - 第一次锁定和创建 lock_guard(adopt_lock) 和创建 unique_lock(defer_lock) 和锁定有什么区别?

c++ - MFC visual c++ LNK2019链接错误

c - 使用 printf scanf 进行 STDIN、STDOUT 重定向挂起

python - 使用 for 循环但忽略第一项?

python - 如何转义在串行术语中接收和转义的西里尔字母代码

c++ - 在 Windows 上安装 QJson