I need all the original HTML entities of a paragraph, especially the accents, the methods I know recover only some entities, as in the example below where ">" is correctly coded but "ç" is not.
It is important that the code can differentiate accents generated or not by entities (as in çã
) because the content comes from an external source and can come without a defined pattern
alert(document.querySelector('p').innerHTML);
<p>situação > ativo</p>
Notes: As the accepted response of @mgibsonbr is not possible, the solution adopted was to use the DOMDocument::saveHTML
, it interprets entities in the same way as the browser, so that the data is the same on both the server and the client.