Base64 encoding for special characters

Hello,

I recently downloaded a base64 library in C and it works perfectly for ascii characters but when i try to encode characters such as 'é', 'ù', or basically any non-ascii character, the encoding is not correct. In addition, printing of the characters is incorrect as well on the console. Due to this issue I am unable to encode image files correctly. Could use some help, please.

Thank you.
Base64 doesn't consume characters, it consumes bytes, and makes no distinction between their values. ('é' and 'ù' are characters, two bytes each in utf-8: \xc3\xa9 and \xc3\xb9, but it can't be relevant to encoding an image file).

If you're using the library correctly and it indeed doesn't encode some bytes, find a working library? Otherwise, show how exactly you're using it.

Here's a demo base64-encoding and decoding a string containing all 256 bytes, using boost: http://coliru.stacked-crooked.com/a/f9ac8cde34359be6
Last edited on
Topic archived. No new replies allowed.