Values in attributes are not being decoded while writing to file

Bug #1853640 reported by Fabio
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
New
Undecided
Unassigned

Bug Description

The following XHTML is an XHTML snnipet that was written to a file using a ElementTree object.

tmpf = open('tmp2.html', 'wb')
etree.ElementTree(xhtml).write(tmpf, pretty_print=True, encoding='utf-8')

The content in head/meta[@content] is the same of head/meta but while writing to the file, only the content in the element is decoded.

<head xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mml="http://www.w3.org/1998/Math/MathML">
  <meta name="license" content="Tous droits r&#xE9;serv&#xE9;s &#xA9; Approches inductives, 2014">Tous droits réservés © Approches inductives, 2014</meta>
</head>

ENVIRONMENT:

Python : sys.version_info(major=3, minor=6, micro=7, releaselevel='final', serial=0)
lxml.etree : (4, 3, 3, 0)
libxml used : (2, 9, 9)
libxml compiled : (2, 9, 9)
libxslt used : (1, 1, 33)
libxslt compiled : (1, 1, 33)

Fabio (fabiobatalha)
description: updated
description: updated
description: updated
Revision history for this message
scoder (scoder) wrote :

I can't reproduce this, but … is it a problem?

Revision history for this message
Fabio (fabiobatalha) wrote :

From my point of view this is a problem once when you write the content in a file using the appropriate encoding the least you expect is to have a consistent result which means to have all the content displayed in a readable matter.

One of the properties of XML is the readability capacity.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.