I ran across a problem using ABCpdf8 for PDF generation: bullets and the Euro sign are displayed as garbled characters.
What’s going on here?
|character name||character||unicode||displayed as||UTF-8|
|bullet||•||U+2022||â€¢||0xE2 0x80 0xA2|
|Euro sign||€||U+20AC||â‚¬||0xE2 0x82 0xAC|
Since .Net is Unicode-based, the problem cannot be caused by .Net sting handling.
My conclusion is that the Doc.AddImageHtml method creates a temporary file in UTF-8 encoding, and the HTML rendering engine (Gecko in this case) needs to be told about the correct encoding:
doc.AddImageHtml( @"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd""> <html xmlns=""http://www.w3.org/1999/xhtml""> <head> <meta http-equiv=""content-type"" content=""text/xhtml; charset=utf-8"" /> ... and more HTML content .... ");
In preparing this blog, my assumption was confirmed in the Notes section
ABCpdf saves this HTML into a temporary file and renders the file using a ‘file://’ protocol specifier. So this is a convenience function – it doesn’t offer any performance enhancements.