我得到???? MySQL数据库中的阿拉伯字符值。使用swift 3,我使用JSON来获取数组数据,然后如果我用英语打印结果就可以了,但是阿拉伯语显示“??? ????”
两个问题: 1)您认为问题是来自JSON的响应吗?
2)如果JSON响应是问题,我会对如何执行转换感到困惑。任何人都可以证明这些编码吗?
这是我的代码
Alamofire.request(URL_USER_LOGIN, method: .post, parameters: parameters).responseJSON
{
response in
//printing response
print(response)
//getting the json value from the server
if let result = response.result.value {
let jsonData = result as! NSDictionary
//if there is no error
if(!(jsonData.value(forKey: "error") as! Bool)){
//getting the user from response
let user = jsonData.value(forKey: "username") as! NSDictionary
print (user)
//getting user values
let userFname = user.value(forKey: "customers_firstname") as! String
//saving user values to defaults
self.defaultValues.set(userFname, forKey: "customers_firstname")