UTF-8 bug with newline \n char
Brought to you by:
takeshi_kanno,
tony2001
I'm building a pdf with libharu, with UTF-8 encoding.
HPDF_UseUTFEncodings(pdf);
NSString *path = [[NSBundle mainBundle] pathForResource: @"DejaVuSans" ofType: @"ttf"];
const char *fontname = HPDF_LoadTTFontFromFile(pdf, [path UTF8String], HPDF_TRUE);
HPDF_Font fontEnUTF = HPDF_GetFont(pdf, fontname, "UTF-8");
HPDF_Page_SetFontAndSize(page3, fontEnUTF, 10.0);
const char* cString = [[itemsArray objectAtIndex:i] cStringUsingEncoding:NSUTF8StringEncoding];
HPDF_UINT charCount = 0;
HPDF_Page_TextRect(page3, 50.0, K_PORTRAIT_HEIGHT, HPDF_Page_GetWidth(page3)-52, 52.0, cString, HPDF_TALIGN_LEFT, &charCount);
Everything is fine, except that it wrongly encode \n char. See here output attached.
Output UTF-8 encoding