-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UnicodeDecodeError: 'ascii' codec can't decode . . . #42
Comments
I have also problems when the source is already in utf-8 (encoding utf-8 to utf-8 gives weird results). Removing the encode works for me. My HTML source files are in UTF-8, as we have many accents in Belgium. I assume it's the programmers job to ensure correct encoding before calling the library, so he can be in complete control what to do if unsupported characters occur. Regards, |
@debaetsr how did you fix the problem? |
Should be fixed on master branch with #81 and released in the next version. |
The commit you referenced deals with the decoding, whereas the problem stated here (which I am also having) is about the encode function in the to_pdf method. |
I'm also having this issue, |
I am having the same problem, with the French language, also utf-8. |
Should be fixed now. Sorry that it took so long for me to get to it... |
When I try to use python-pdfkit with certain HTML content that has certain characters in it, it fails with one of these errors if the html content is loaded into memory:
or
But, python pdfkit works just fine if it is provided with just a filename, and so does wkhtmltopdf.
I think that python pdfkit is doing something unsafe with strings; perhaps it should assume that the input is just bytes.
python-pdfkit error demo.zip
The text was updated successfully, but these errors were encountered: