Escaped angle brackets are converted to < and > inside pre and code tags

Bug #2062029 reported by Alok Hota
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Beautiful Soup
Invalid
Undecided
Unassigned

Bug Description

Take HTML data like the following:

###
<pre>
#include &lt;iostream&gt;

std::cout &lt;&lt; "Hello, world" &lt;&lt; std::endl;
</pre>
###

and

###
<code>&lt;iostream&gt;</code>
###

The angle brackets are significant here for C++ syntax. BeautifulSoup will convert these to "<iostream>" inside the HTML as if it was a tag, which of course it isn't. This leads to the text not being displayed at all in the browser.

Revision history for this message
Alok Hota (ahota) wrote :

Sorry, forgot to mention this occurs when running prettify(). Just doing a decode() works as expected.

Revision history for this message
Alok Hota (ahota) wrote :

Example doesn't exhibit the problem, and I may have found the issue in my full code. Sorry!

Changed in beautifulsoup:
status: New → Invalid
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.