Skip to content

Commit afa1efc

Browse files
committed
Add test for JazzCore#42
1 parent af916aa commit afa1efc

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<body>
4+
This is a bad character -->   <--
5+
</body>
6+
</html>

tests/pdfkit-tests.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,5 +413,12 @@ def test_raise_error_if_bad_wkhtmltopdf_option(self):
413413
raised_exception = cm.exception
414414
self.assertRegex(str(raised_exception), '^wkhtmltopdf exited with non-zero code 1. error:\nUnknown long argument --bad-option\r?\n')
415415

416+
def test_issue_42_encode_file_with_unicode_char(self):
417+
with open('fixtures/issue_42_bad_char_page.html', 'r') as f:
418+
data = f.read()
419+
r = pdfkit.PDFKit(data, 'string')
420+
output = r.to_pdf()
421+
self.assertEqual(output[:4].decode('utf-8'), '%PDF')
422+
416423
if __name__ == "__main__":
417424
unittest.main()

0 commit comments

Comments
 (0)