Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/159.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ Boost:如何检查文本文件字符编码/字符集?_C++_File_Boost_Text_Character Encoding - Fatal编程技术网

C++ Boost:如何检查文本文件字符编码/字符集?

C++ Boost:如何检查文本文件字符编码/字符集?,c++,file,boost,text,character-encoding,C++,File,Boost,Text,Character Encoding,我想知道如何使用boost从文本文件中获取字符编码/字符集?它在boost::locale或boost::filesystem中的任何位置吗?boost中没有任何内容。为此,您需要测试的是您自己。伪代码中的算法: if BOM present: use encoding specified by BOM else: try: use UTF-8 except: use ANSI # But only on Windows 如果文本文件中没有特殊标记(如UTF8 BO

我想知道如何使用boost从文本文件中获取字符编码/字符集?它在boost::locale或boost::filesystem中的任何位置吗?

boost中没有任何内容。为此,您需要测试的是您自己。伪代码中的算法:

if BOM present:
  use encoding specified by BOM
else:
  try:
    use UTF-8
  except:
    use ANSI # But only on Windows

如果文本文件中没有特殊标记(如UTF8 BOM),则无法知道。您可以通过查找文件中的特殊字符来推断它。文件编码和文件系统之间有什么联系?没有。