You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
diff --git a/xhtml2pdf/parser.py b/xhtml2pdf/parser.py
index 4d2188d..b3ccaf5 100644
--- a/xhtml2pdf/parser.py
+++ b/xhtml2pdf/parser.py
@@ -767,6 +767,7 @@ def pisaParser(src, context, default_css="", xhtml=False, encoding="utf8", xml_o
src = pisaTempFile(src, capacity=context.capacity)
# To pass the encoding used to convert the text_type src to binary_type
# on to html5lib's parser to ensure proper decoding
+ if encoding:
parser_kwargs['transport_encoding'] = encoding
# # Test for the restrictions of html5lib
A workaround is to not encode the source_html.
This lets xhtml2pdf do the encoding and set the encoding when passed to html5lib.
System Information
OS version: Ubuntu 22.04
Python version: 3.10.12
XHTML2PDF version: 0.2.11
The text was updated successfully, but these errors were encountered:
Describe the Bug
When giving
pisa.CreatePDF
an encoded bytestring, the result is encoded withcp1252
.Minimal Example to Reproduce
Expected Behavior
test.pdf contains only: •
Actual Behavior
test.pdf contains: •
Additional Information
Example why this happens:
Seems related to: #468
A possible in XHTML2PDF solution:
A workaround is to not encode the source_html.
This lets xhtml2pdf do the encoding and set the encoding when passed to html5lib.
System Information
OS version: Ubuntu 22.04
Python version: 3.10.12
XHTML2PDF version: 0.2.11
The text was updated successfully, but these errors were encountered: