I`m using
Alamofire.request(.GET, "http://")
.responseString { _, _, string, _ in
println(string)
}
to make get-request. Response contains сyrillic symbols and in responseString they looks like this (top-right):
How should I fix encoding?
You can use NSUTF8StringEncoding
with Alamofire's responseString
method:
Alamofire.request(.GET, "http://my1test.ru/applejesus.php?task=getCategory&categoryNumber=1")
.responseString(encoding: NSUTF8StringEncoding) { (request, response, string, error) -> Void in
if let result = string {
println(result)
}
}
Result:
picture{http://ipic.su/img/img7/fs/ProdukciyaApple.1438079721.png},title{Продукция Apple}
Now, you have to use responseString(encoding: String.Encoding.utf8)
instead
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With