python - unicode decode error for weasyprint -


i try , use weasyprint prepare pdf, , string, following error. decode string unicode before feeding weasyprint. suggestions?

'utf8' codec can't decode byte 0xc2 in position 0: unexpected end of data request method: django version: 1.6.2 exception type: unicodedecodeerror exception value:
'utf8' codec can't decode byte 0xc2 in position 0: unexpected end of data exception location: /usr/lib/python2.7/encodings/utf_8.py in decode, line 16 python executable: /usr/bin/python python version: 2.7.6 python path:

unicode error hint

the string not encoded/decoded was: � traceback switch copy-and-paste view

/usr/local/lib/python2.7/dist-packages/weasyprint/__init__.py in write_pdf         return self.render(stylesheets).write_pdf(target, zoom, attachments) ... /usr/local/lib/python2.7/dist-packages/weasyprint/__init__.py in render         return document._render(self, stylesheets, enable_hinting) ... /usr/local/lib/python2.7/dist-packages/weasyprint/document.py in _render         return cls([page(p, enable_hinting) p in page_boxes], ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/__init__.py in layout_document     pages = list(make_all_pages(context, root_box)) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/pages.py in make_all_pages             context, root_box, page_type, resume_at, content_empty) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/pages.py in make_page         positioned_boxes, positioned_boxes, adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_level_layout             absolute_boxes, fixed_boxes, adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_box_layout             page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_container_layout                     adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_level_layout             absolute_boxes, fixed_boxes, adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_box_layout             page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_container_layout                     adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_level_layout             absolute_boxes, fixed_boxes, adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_box_layout             page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_container_layout                     adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_level_layout             absolute_boxes, fixed_boxes, adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_box_layout             page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_container_layout                     adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_level_layout             device_size, page_is_empty, absolute_boxes, fixed_boxes) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/tables.py in table_layout         all_groups_layout() ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/tables.py in all_groups_layout             skip_stack, position_y, max_position_y, page_is_empty) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/tables.py in body_groups_layout                 group, position_y, max_position_y, page_is_empty, skip_stack) /usr/local/lib/python2.7/dist-packages/weasyprint/layout/tables.py in group_layout                     fixed_boxes=fixed_boxes) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_container_layout                     adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_level_layout             absolute_boxes, fixed_boxes, adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_box_layout             page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_container_layout                     adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_level_layout             absolute_boxes, fixed_boxes, adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_box_layout             page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_container_layout                     adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_level_layout             absolute_boxes, fixed_boxes, adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_box_layout             page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_container_layout                     adjoining_margins) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_level_layout             device_size, page_is_empty, absolute_boxes, fixed_boxes) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/tables.py in table_layout         all_groups_layout() ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/tables.py in all_groups_layout             skip_stack, position_y, max_position_y, page_is_empty) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/tables.py in body_groups_layout                 group, position_y, max_position_y, page_is_empty, skip_stack) /usr/local/lib/python2.7/dist-packages/weasyprint/layout/tables.py in group_layout                     fixed_boxes=fixed_boxes) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py in block_container_layout             line, resume_at in lines_iterator: ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/inlines.py in iter_line_boxes             device_size, absolute_boxes, fixed_boxes) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/inlines.py in get_next_linebox             line_fixed, line_placeholders, waiting_floats) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/inlines.py in split_inline_box             waiting_floats) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/inlines.py in split_inline_level             context, box, max_x - position_x, max_x, skip) ... /usr/local/lib/python2.7/dist-packages/weasyprint/layout/inlines.py in split_text_box         text, box.style, context.enable_hinting, available_width, line_width) /usr/local/lib/python2.7/dist-packages/weasyprint/text.py in split_first_line         first_part = utf8_slice(text, slice(temp_second_line_index)) ... /usr/local/lib/python2.7/dist-packages/weasyprint/text.py in utf8_slice     return string.encode('utf-8')[slice_].decode('utf-8') ... /usr/lib/python2.7/encodings/utf_8.py in decode     return codecs.utf_8_decode(input, errors, true) ... 

your issue seems related bug in weasyprint : https://github.com/kozea/weasyprint/issues/285.

the bug has been resolved.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -