Then I would guess that you have an encoding problem in the larger sense.
Somewhere along the long chain from mail sender via your program to the output of your program, things are getting decoded in the wrong way.
I know of no other way than to check at every conversion step that you decode the byte sequence from the right encoding.
As both Content-Type header lines are equal, you should handle them in an equal fashion. This could mean that the sending mail program already encodes the mail in a wrong way. That would be out of your influence.
I still recommend checking the remaining parts of your program as to whether you mix up different string encodings when converting or printing output.
Returns a human readable decoded string on some emails with base64 encoding but not on all emails with base64 encoding. This is a headache for me because if I change the code to just output the string it breaks on emails that need the string manually decoded.
All I am doing is calling "parse_data" and then "bodyhandle->as_string". I'm not sure where the decoding process happens. The original data is definitely base64 encoded which I can see by looking at the raw email data.