0

Does anyone know how to convert a string from ISO-8859-1 to UTF-8 in C++?

I'm parsing an email to get email subject, which is encoded using RFC-2047. I'm decoding a string to bytes using base64 decoding & Q decoding. But when I use byte stream as it is then garbage characters gets displayed in email.

Thank you.

Pravin
  • 371
  • 1
  • 15
  • 1
    Already answered here: http://stackoverflow.com/questions/6140223/c-boost-encode-decode-utf-8 – mikedu95 Jan 20 '16 at 12:05
  • @mikedu95 If this question is already answered please flag/vote to close. – Jonathan Mee Jan 20 '16 at 12:46
  • I leave the possibility that the answer, which is boost-based, isn't acceptable for the OP. Or should I flag/vote even in such case ? – mikedu95 Jan 20 '16 at 12:52
  • thank you, I can't use boost in my application. I did tryouts with iconv, "iconv -f ISO-8859-1 -t UTF-8//TRANSLIT /tmp/test1 > /tmp/test2; cat /tmp/test2" works for me. – Pravin Jan 21 '16 at 12:53
  • I tried to implement same in c, iconv() api gives me error EINVAL, no getting exact reason. – Pravin Jan 21 '16 at 13:07

0 Answers0