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 UTF-8. I’m reading data that is in 8-bit ISO-8859-1 encoding, but need to convert it to a UTF-8 string for use in an SQLite database and eventually an Android app.
I found one commercial product, but it’s beyond my budget at this time.
If your source encoding will always be ISO-8859-1, this is trivial. Here’s a loop:
For safety you need to ensure that the output buffer is twice as large as the input buffer, or else include a size limit and check it in the loop condition.