有哪些 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/