Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting ’ encoding errors with NRECO Html to Pdf

Tags:

html

c#

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" />
like image 333
user1732364 Avatar asked Sep 30 '15 19:09

user1732364


1 Answers

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.

like image 172
Mr Lister Avatar answered Nov 15 '22 20:11

Mr Lister