Opened 9 years ago
Closed 9 years ago
#9870 closed Bugs (invalid)
boost::property_tree::write_xml_element does not encode character before writing to attribute value
Reported by: | Owned by: | Sebastian Redl | |
---|---|---|---|
Milestone: | To Be Determined | Component: | property_tree |
Version: | Boost 1.46.1 | Severity: | Problem |
Keywords: | Cc: |
Description
The character in attribute value is not encoded in entity names and may output a quote " to attribute value which escapes the attribute value and thus outputs a wrong value.
if the attribute stored in attribs is ("mystring", "\"") under node x. The expected output string is <x mystring="""/> instead of <x mystring="""/>. The value is ", but not null string and the quote in the tag should be balanced.
This can resolve by changing "boost/property_tree/detail/xml_parser_write.hpp" Line 118 to 119 from
stream << Ch(' ') << it->first << Ch('=') << Ch('"') << it->second.template get_value<std::basic_string<Ch> >() << Ch('"');
to
stream << Ch(' ') << it->first << Ch('=') << Ch('"') << encode_char_entities(it->second.template get_value<std::basic_string<Ch> >()) << Ch('"');
Change History (2)
comment:1 by , 9 years ago
Version: | Boost 1.55.0 → Boost 1.46.1 |
---|
comment:2 by , 9 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Sorry the bug has been fixed in v1.55.0. Sorry about a false alarm. The bug was found originally in v1.46.1.