简体   繁体   中英

Getting ’ encoding errors with NRECO Html to Pdf

I am using the NReco Html to Pdf conversion dll for C# but it's failing to encode correctly. The html is rendering properly but when i render the pdf, it fails to convert the ' or " characters correctly which i know is encoding. Looking for someone who has used this dll and solved this issue, below is my encoding meta for the html page.

<meta http-equiv="Content-Type" charset="UTF-8" />

The meta command is wrong. It should be either

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

or

<meta charset="UTF-8"/>

(with no http-equiv).

Note, however, that using a meta command for the charset is no guarantee that the desired charset is indeed used. The actual http header may override this setting with a charset of its own.

Also, with regards to your comment that it's rendered correctly, note that web browsers may use a different algorithm to determine the encoding than the dll. Correcting the meta command may or may not help.

If the required data is coming from database, please verify the special characters properly. This issue got resolved for me when I did change in the below places:

from 'S to 'S and from – to -

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM