swift 解析json 字符串转不成中文


从接口获取到的信息

%7b%22USER%5fEMAIL%22%3a%22987654321%40qq%2ecom%22%2c%22USER%5fLAST%5fDATETIME%22%3a%222016%2d08%2d19%2011%3a54%3a42%22%2c%22CONFIG%5fID%22%3a%22cornucop%22%2c%22USER%5fMOBILE%5fBIND%22%3a%2215599999999%22%2c%22USER%5fREG%5fTIME%22%3a%222016%2d02%2d18%2014%3a52%3a17%22%2c%22USER%5fDC%5fSIGN%22%3a%220%22%2c%22USER%5fTRUE%5fSTATUS%22%3a%221%22%2c%22USER%5fTRUE%5fNI%5fTYPE%22%3a%221545156465146548%22%2c%22MER%5fCODE%22%3a%22LP8100000000003%22%2c%22RED%5fCOUNT%22%3a%220%22%2c%22USER%5fNI%5fNUM%22%3a%221545156465146548%22%2c%22USER%5fMOBILE%22%3a%2215599999999%22%2c%22USER%5fMOBILE%

大概是这样的数据,我对这串数据,进行了URLdecode,然后解析之前是第一个图。中文无法解析出来。求帮帮忙

没啥问题,因为 Xcode 的 Console 打印中文时在这种情况下会自动打印 Unicode 编码。你试着将它们显示在 label 上就没有问题了

把数据显示到label上 看看还是不是乱码

发表评论

电子邮件地址不会被公开。 必填项已用*标注