簡體   English   中英

在responseJSON中帶有重音符號字符串的Alamofire請求

[英]Alamofire request with accent string in the responseJSON

我正在使用以下代碼進行請求:

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。

當我嘗試從String varname key分配值時,我得到了: luz stellagonzÃlez 但這可能是luz stellagonzález

    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 = "*******";
    }*/

編碼錯誤...

就像@Eric Aya在評論中說的那樣,問題出在服務器端,編碼錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM