Ticket #5033: property.tree.read.UTF-8.patch

File property.tree.read.UTF-8.patch, 951 bytes (added by Ilya Bobyr <ilya.bobyr@…>, 10 years ago)

Property Tree JSON reader fix for UTF-8 encoded string

  • boost/property_tree/detail/json_parser_read.hpp

    Author: Ilya Bobyr <ilya.bobyr@gmail.com>
    Date:   Mon Sep 17 09:44:50 2012 -0700
    
        [B] Boost.PropertyTree: Correctly read UTF-8
        
        Boost.PropertyTree has a fix in version 1.45 to write narrow characters, in
        case char is signed, with highest bit set correctly.  This this a similar
        fix for the read side.
    
    a b namespace boost { namespace property_tree { namespace json_parser  
    145145            a_unicode(context &c): c(c) { }
    146146            void operator()(unsigned long u) const
    147147            {
    148                 u = (std::min)(u, static_cast<unsigned long>((std::numeric_limits<Ch>::max)()));
     148                typedef typename make_unsigned<Ch>::type UCh;
     149                u = (std::min)(u, static_cast<unsigned long>((std::numeric_limits<UCh>::max)()));
    149150                c.string += Ch(u);
    150151            }
    151152        };