alibaba / alibaba/HandyJSON

iPhone12反序列化小数点变成逗号

Open
#435 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
4.3k
Forks
677
PR merge metrics
No merged PRs in 30d

Description

源码:
`import UIKit
import HandyJSON

class MyModel: HandyJSON {
var name: String = ""
var height: String = ""
required init() {

}
}

class TestAsyncAwait: UIViewController{

override func viewDidLoad() {
super.viewDidLoad()
self.testModel()
}

func testModel(){
let json = "{\"name\":\"abc\", \"height\":0.5}"
let model = MyModel.deserialize(from: json)
print("model", model?.toJSONString())
}
}
`

iPhone12 iOS14.2 异常0.5=>"0,5" 点号变成逗号
执行结果:
`
model Optional("{\"height\":\"0,5\",\"name\":\"abc\"}")
`

iPhoneXS iOS14.2 正常0.5=>"0.5"
执行结果:
`
model Optional("{\"height\":\"0.5\",\"name\":\"abc\"}")
`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the inline MyModel.deserialize(from:) example and inspect how the height value is converted and emitted by toJSONString() on iPhone 12 and iPhone XS. Done means the same JSON decimal value remains "0.5" rather than becoming "0,5" across the reported iOS 14.2 devices.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.