{
CI1 = 1;
CI2 = 3;
CI3 = 6;
CI4 = 8;
CI5 = 9;
CI6 = 12;
CN1 = "14(1)";
CN2 = "13(1)";
CN3 = "13(2)";
CN4 = "13(4)";
CN5 = "12(4)";
CN6 = "12(1)";
GID1 = 13;
GID2 = 12;
GN1 = "\U6570\U5b66";
GN2 = "\U7269\U7406";
KEY = CGGpLHs;
KN = "\U963f\U65af\U8482\U82ac";
KS = 1;
SC = 0;
SUP = Y;
TN = "\U8c2d\U52b2";
tID = 1;
}解析的結果,原本是字符串的數據都變成了亂碼,例如kn和tn的數據原本是漢字,現在都成編碼了。
使用的是這個解析方式
http.post(url, mapPair: dict, completionHandler: {(data: NSData?, error: NSError?) -> Void in
if (error != nil){
println("error=\(error!.localizedDescription)")
}else{
let jsonDictionary: NSDictionary = NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions.MutableContainers, error: nil) as! NSDictionary
println(data)
println(jsonDictionary)
}
})還望廣大懂得給個指點,要怎麼弄才能把漢字也解析出來呢?謝謝!!!!!
你直接打印一個Array或者Dictionary,如果它裡面的字符串是中文,就會變成 \Uxxxx 之類的編碼,這是它內部存儲的格式,你把值取出來之後再單獨輸出,它又是正常的中文了
例如
let kn = jsonDictionary.objectForKey("KN")
println(kn)