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

后端 未结 6 892
礼貌的吻别
礼貌的吻别 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:37

    ISO-8859-1 to UTF-8 involves nothing more than the encoding algorithm because ISO-8859-1 is a subset of Unicode. So you already have the Unicode code points. Check Wikipedia for the algorithm.

    The C++ aspects -- integrating that with iostreams -- are much harder.

    I suggest you walk around that mountain instead of trying to drill through it or climb it, that is, implement a simple string to string converter.

    Cheers & hth.,

提交回复
热议问题