Alamofire请求在responseJSON中使用重音字符串

时间:2016-09-12 05:56:08

标签: ios json swift alamofire

我正在使用以下代码发出请求:

Alamofire.request(.GET, url).responseJSON { (response) in
            switch response.result{
            case .Success(let JSON):
            print (JSON as! NSDictionary)

响应是:

   {
        guardado =     {
            email = "xxxxgopy@hotmail.com";
            id = 9552;
            name = "luz stella gonz\U00c3\U00a1lez";
            pwd = "*******";
        };
    }

如何处理unicode字符\ U00c3 \ U00a1。

当我尝试从name keyString var分配值时,我得到了这个: luzstellagonzález 。但它可能是 luzstellagonzález

2 个答案:

答案 0 :(得分:0)

    let dictonary = ["email":"xxxxgopy@hotmail.com","id":9552,"pwd" :"*******","name":"luz stella gonz\u{00E1}lez"]
    print(dictonary)
   /* {
        email = "xxxxgopy@hotmail.com";
        id = 9552;
        name = "luz stella gonzález";
        pwd = "*******";
    }*/

编码错误......

答案 1 :(得分:0)

像@Eric Aya在评论中说问题出在服务器端,编码错误。