Utf 8 NSJ序列化和Swift中的非拉丁(西里尔)字符

Utf 8 NSJ序列化和Swift中的非拉丁(西里尔)字符,utf-8,swift,ios8,nsjsonserialization,Utf 8,Swift,Ios8,Nsjsonserialization,这是我解析JSON的函数: func jsonParsingWeather(urlPath:String) -> NSDictionary { var utf8URLPath = urlPath.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding) println("URL path for JSON: \(utf8URLPath)") var streamData:NSData = NSDa

这是我解析JSON的函数:

func jsonParsingWeather(urlPath:String) -> NSDictionary {
    var utf8URLPath = urlPath.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)
    println("URL path for JSON: \(utf8URLPath)")
    var streamData:NSData = NSData(contentsOfURL: NSURL(string: utf8URLPath))
    var error: NSError?
    var fullWeatherDictionary: NSDictionary = NSJSONSerialization.JSONObjectWithData(streamData, options: NSJSONReadingOptions.MutableContainers, error: &error) as NSDictionary
    println("Full parsing array: \(fullWeatherDictionary)")
    return fullWeatherDictionary
}
在西里尔文字处理中发现问题

urlPath=http://autocomplete.wunderground.com/aq?query=СаМаиа

utf8URLPath=http://autocomplete.wunderground.com/aq?query=%D0%A1%D0%B0%D0%BC%D0%B0%D1%80%D0%B0

在Safari浏览器中,两行给出相同的结果:
{“结果”:[{“名称”:“Саааааа,аааааааааааааааааа”、“类型”:“城市”、“c”:“RU”、“zmw”:“000001.28807”、“tz”:“欧洲/萨马拉”、“

但是!数组
fullWeatherDictionary
为空

{
    RESULTS =     (
    );
}
为了进行比较,请使用拉丁字符串:

urlPath=http://autocomplete.wunderground.com/aq?query=Samara

utf8URLPath=http://autocomplete.wunderground.com/aq?query=Samara

在Safari浏览器中,两行给出相同的结果:
{“RESULTS”:[{“name”:“Samara,rus”,“type”:“city”,“c”:“RU”,“zmw”:“00000.1.28807”,“tz”:“Europe/Samara”,“tzs”:“SAMT”,“l”:“/q/zmw:00000.1.28807”,“ll”:“53.250000 50.450001”,“lat”:“53.250000”,“lon”:“50.450001”},{“name”:“Samarate,意大利”,“type”:“city”,“c”:“IT”,“zmw”:“00000101.16066”,“tz”:“Europe/Rome”,“tzs”:“tzs”:“CEST”、“l”:“/q/zmw:00000.101.16066”、“ll”:“45.625370 8.783435”、“lat”:“45.625370”、“lon”:“8.783435”}……。

因此,数组
fullWeatherDictionary
为:

{
    RESULTS =     (
                {
            c = RU;
            l = "/q/zmw:00000.1.28807";
            lat = "53.250000";
            ll = "53.250000 50.450001";
            lon = "50.450001";
            name = "Samara, Russia";
            type = city;
            tz = "Europe/Samara";
            tzs = SAMT;
            zmw = "00000.1.28807";
        },
.......................

有什么问题吗?如果是非拉丁字符,为什么数组的内容不同http://autocomplete.wunderground.com/aq?query=%D0%A1%D0%B0%D0%BC%D0%B0%D1%80%D0%B0
还提供Safari中的空结果


这是服务器问题。

该死!抱歉,问题已解决:


我在俄语和地区上配置了iOS模拟器,一切都很好——数值都很好​​在以任何语言出现的数组中

JSON解析的
错误
说明了什么?带有未替换西里尔字符的URL是什么?(我懒得全部查找)URL
http://autocomplete.wunderground.com/aq?query=%D0%A1%D0%B0%D0%BC%D0%B0%D1%80%D0%B0
使用UTF8等于URL
http://autocomplete.wunderground.com/aq?query=СаМааааа
带有未替换的西里尔字母(
СааааМаа
-是带有西里尔字母的这是带有
http://autocomplete.wunderground.com/aq?query=%D0%A1%D0%B0%D0%BC%D0%B0%D1%80%D0%B0
URL:JSON响应为空。