【发布时间】:2017-03-16 10:59:39
【问题描述】:
ObjectMapper 转换以下 JSON 字符串不正确。对于某些第二个 unicode char 之后的整个字符串在映射后被剪切。 \U33a1 代表 m2。
text = "Bitte geben Sie Ihre vermietete Fl\U00e4che (\U33a1) an.";
override func mapping(map: Map) {
super.mapping(map: map)
hintText = map["hintText"]
inputType <- (map["inputType"],inputTypeTransformer)
value <- map["value"]
capitalizeFirstLetter <- map["capitalizeFirstLetter"]
maxLength <- map["maxLength"]
readOnly <- map["readOnly"]
}
映射hintText后得到值“Vermietete Fläche(”
除了这个 unicode 字符之外,所有其他的德语重音字符都被正确保存。
【问题讨论】:
-
我怀疑问题出现在之前将对象传递给映射器
-
其实Json字典的值是正确的
标签: ios swift unicode objectmapper