Re: [xml] HTMLtree.c escapes braces

On Thu, Sep 24, 2015 at 10:12:25PM +0000, Bruce Sinclair wrote:
Hi Daniel,

We have had the issue that libxml2 encodes curly braces as character references in HTML output because of 
the following code in HTMLtree.c:

               escaped = xmlURIEscapeStr(tmp, BAD_CAST"@/:=?;#%&,+");
               if (escaped != NULL) {
                    xmlBufferWriteQuotedString(buf->buffer, escaped);
                } else {
                    xmlBufferWriteQuotedString(buf->buffer, value);

We don't think the curly braces, "{" and "}", should be changed to character references.  Doing so causes a 
problem with the use of braces in a Server Response File (SRF) generated with libxml2.  We change the first 
line of the above code to:

               escaped = xmlURIEscapeStr(tmp, BAD_CAST"@/:=?;#%&,+{}");

to eliminate this issue.  Could this be accepted as a fix to libxml2?

  Hi Bruce,

  I don't understand, that code is in attribute content escaping, and
for me "{" and "}" are not escaped:

thinkpad2:~/XML -> cat ./tst.html
<img alt="{foo}"/>
thinkpad2:~/XML -> ./xmllint --html ./tst.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "";>
<img alt="{foo}">
thinkpad2:~/XML -> 

Please provide a reproducer with xmllint so I understand what is going on,



Daniel Veillard      | Open Source and Standards, Red Hat
veillard redhat com  | libxml Gnome XML XSLT toolkit | virtualization library

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]