AW: Re: [xml] xmlEncodeSpecialChars problem



On Thu, Apr 20, 2006 at 01:44:28PM +0200, oliverst online de wrote:
I have a problem, that I changed from my own encoding function to 
xmlEncodeEntitiesReentrant and suddenly apostrophs (') appeared in my 
attributes. So I tried xmlEncodeSpecialChars and they still were present. Same 
problem with the quotes ("), but then found out xmlEncodeSpecialChars does 
that. But now I have the problem, that nothing works anymore, because the 
apostroph still isn't encoded. Judging from the function descrption I assume, 
but both should be the same (differing in the encoding of quote (")) and 
should encode *all* the problematic characters, which (') is one of. Is there 
a reason, why it isn't concerted?

 Because it's usually not needed. libxml2 serialization functions know
how to handle ' and " in attribute functions:

paphio:~ -> cat tst.xml
<foo bar="'" bar2='"'> a " b ' c </foo>
paphio:~ -> xmllint tst.xml
<?xml version="1.0"?>
<foo bar="'" bar2="&quot;"> a " b ' c </foo>
paphio:~ ->

There is something else broken

I am also using the function to encode strings, I don't put in XMLs, but HTMLs and other places and from the 
documentation I assumed, it will handle all cases of special characters to get a properly encoded string...



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