Re: [Boost-bugs] [Boost C++ Libraries] #1678: Boost.property_tree::read_xml does not parse UNICODE file with BOMs

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #1678: Boost.property_tree::read_xml does not parse UNICODE file with BOMs
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-01-26 02:19:31


#1678: Boost.property_tree::read_xml does not parse UNICODE file with BOMs
--------------------------------------+-------------------------------------
  Reporter: tom | Owner: cornedbee
      Type: Patches | Status: assigned
 Milestone: Boost 1.47.0 | Component: property_tree
   Version: Boost Development Trunk | Severity: Showstopper
Resolution: | Keywords: property_tree UNICODE BOM read_xml
--------------------------------------+-------------------------------------
Changes (by zhuo.qiang@…):

  * type: Bugs => Patches
  * severity: Problem => Showstopper
  * milestone: Boost 1.36.0 => Boost 1.47.0

Comment:

 The following is a fix for this, anyone pleaes review this fix and apply
 it to the trunk:

 /property_tree/detail/rapidxml.hpp(1730):
 {{{
 #!cpp
         // Parse BOM, if any
         template<int Flags>
         void parse_bom(char *&text)
         {
             // UTF-8
             if (text[0] == 0xEF &&
                 text[1] == 0xBB &&
                 text[2] == 0xBF)
             {
                 text += 3; // Skip utf-8 bom
             }
         }

         // Parse BOM, if any
         template<int Flags>
         void parse_bom(wchar_t *&text)
         {
             // UTF-16
             if (text[0] == L'\uFEFF')
             {
                 text += 1; // Skip utf-16 bom
             }
         }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/1678#comment:3>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:05 UTC