jsoncpp中文繁体或者日文解析错误处理

jsoncpp 遇到繁体字内码的问题

  (2011-11-23 00:37:10)
标签: 

it

分类: Windows
使用了jsoncpp一段时间,遇到的最大问题就是当遇到繁体字时,由于内码的问题导致解析出错。
例如"黒"内码最后是'\'的转义符号。唯有是修改代码做出特定的处理。不知道有没有其他更好的处理办法?


此问题不是因为中文的问题,是因为
        
       /** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a> document.
        * \param document UTF-8 encoded string containing the document to read.
       * \param root [out] Contains the root value of the document if it was
       *             successfully parsed.
       * \param collectComments \c true to collect comment and allow writing them back during
       *                        serialization, \c false to discard comments.
       *                        This parameter is ignored if Features::allowComments_
       *                        is \c false.
       * \return \c true if the document was successfully parsed, \c false if an error occurred.
       */
         Reader::( const std::string &document, 
                  Value &root,
                  bool collectComments = true );

请注意输入的必须是utf-8编码的 string不能是本地编码的多字节,所以在输入字符串时不能使用本地编码,否则解析就会出错




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值