Convert ISO-8859-1 strings to UTF-8 in C/C++

后端 未结 6 884
礼貌的吻别
礼貌的吻别 2020-12-05 05:27

You would think this would be readily available, but I\'m having a hard time finding a simple library function that will convert a C or C++ string from ISO-8859-1 coding to

6条回答
  •  时光取名叫无心
    2020-12-05 05:30

    You can use the boost::locale library:

    http://www.boost.org/doc/libs/1_49_0/libs/locale/doc/html/charset_handling.html

    The code would look like this:

    #include 
    std::string utf8_string = to_utf(latin1_string,"Latin1");
    

提交回复
热议问题