【问题标题】:Object mapping from JSON data thanks to RestKit 0.20.3借助 RestKit 0.20.3 从 JSON 数据映射对象
【发布时间】:2013-08-15 01:41:39
【问题描述】:

我正在尝试从以拉丁 9 (ISO/IEC 8859-15) 编码的 JSON 数据映射对象(不幸的是,我无法将其更改为 UTF-8

我的 JSON 数据包含一些重音符号,这就是为什么我从 RKResponseMapperOperation.m 中的 - (id)parseResponseData:(NSError **)error 函数中得到一个基础错误:

Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" 
(Unable to convert data to string around character 963.) 
UserInfo=0x8258cc0 {NSDebugDescription=Unable to convert data to string around character 963.}

有办法解决吗?

PS:这个问题链接到这个帖子 => Mapping json with RestKit 0.20.3

【问题讨论】:

    标签: ios json restkit-0.20 non-ascii-characters latin9


    【解决方案1】:

    如果您无法更改源编码,则应将文本内容更改为对字符进行 HTML 编码,然后在收到 JSON 并将其映射到目标对象后对其进行解码。

    【讨论】:

      猜你喜欢
      • 2013-08-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-14
      • 1970-01-01
      • 2017-12-15
      • 1970-01-01
      相关资源
      最近更新 更多