|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r71993 - in branches/release: boost/property_tree boost/property_tree/detail libs/property_tree libs/property_tree/test
From: sebastian.redl_at_[hidden]
Date: 2011-05-16 14:39:11
Author: cornedbee
Date: 2011-05-16 14:39:10 EDT (Mon, 16 May 2011)
New Revision: 71993
URL: http://svn.boost.org/trac/boost/changeset/71993
Log:
Merge UTF-8 XML support improvements (r69622) to release. Fixes bug 5203.
Properties modified:
branches/release/boost/property_tree/ (props changed)
branches/release/libs/property_tree/ (props changed)
Text files modified:
branches/release/boost/property_tree/detail/rapidxml.hpp | 6 ++++--
branches/release/libs/property_tree/test/test_xml_parser_common.hpp | 10 +++++++++-
branches/release/libs/property_tree/test/xml_parser_test_data.hpp | 5 +++++
3 files changed, 18 insertions(+), 3 deletions(-)
Modified: branches/release/boost/property_tree/detail/rapidxml.hpp
==============================================================================
--- branches/release/boost/property_tree/detail/rapidxml.hpp (original)
+++ branches/release/boost/property_tree/detail/rapidxml.hpp 2011-05-16 14:39:10 EDT (Mon, 16 May 2011)
@@ -313,8 +313,10 @@
template<class Ch>
inline size_t get_index(const Ch c)
{
- // If not ASCII char, its sematic is same as plain 'z'
- if (c > 255)
+ // If not ASCII char, its semantic is same as plain 'z'.
+ // char could be signed, so first stretch and make unsigned.
+ unsigned n = c;
+ if (n > 127)
{
return 'z';
}
Modified: branches/release/libs/property_tree/test/test_xml_parser_common.hpp
==============================================================================
--- branches/release/libs/property_tree/test/test_xml_parser_common.hpp (original)
+++ branches/release/libs/property_tree/test/test_xml_parser_common.hpp 2011-05-16 14:39:10 EDT (Mon, 16 May 2011)
@@ -63,6 +63,7 @@
{
using namespace boost::property_tree;
+ typedef typename Ptree::data_type::value_type char_type;
generic_parser_test_ok<Ptree, ReadFuncWS, WriteFuncWS>
(
@@ -104,7 +105,7 @@
(
ReadFuncWS(), WriteFuncWS(), ok_data_5, NULL,
"testok5.xml", NULL, "testok5out.xml",
- 3, umlautsize<typename Ptree::data_type::value_type>(), 12
+ 3, umlautsize<char_type>(), 12
);
generic_parser_test_error<Ptree, ReadFuncWS, WriteFuncWS, xml_parser_error>
@@ -131,6 +132,13 @@
"testpr1678.xml", NULL, "testpr1678out.xml", 2, 0, 4
);
+ generic_parser_test_ok<Ptree, ReadFuncWS, WriteFuncWS>
+ (
+ ReadFuncWS(), WriteFuncWS(), bug_data_pr5203, NULL,
+ "testpr5203.xml", NULL, "testpr5203out.xml",
+ 3, 4 * umlautsize<char_type>(), 13
+ );
+
}
#endif
Modified: branches/release/libs/property_tree/test/xml_parser_test_data.hpp
==============================================================================
--- branches/release/libs/property_tree/test/xml_parser_test_data.hpp (original)
+++ branches/release/libs/property_tree/test/xml_parser_test_data.hpp 2011-05-16 14:39:10 EDT (Mon, 16 May 2011)
@@ -768,4 +768,9 @@
const char *bug_data_pr1678 =
"\xEF\xBB\xBF<?xml version=\"1.0\" encoding=\"utf-8\"?><root/>";
+// russian
+const char *bug_data_pr5203 =
+ "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
+ "<name>\xD0\xAE\xD0\xBD\xD0\xB8\xD1\x82</name>";
+
#endif
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk