UTF-8 string encoding (Swift)
Let’s assume you have a human-friendly string and you want to make it a part of url. It’s not that hard:
[code language=”objc”]
var baseUrl : String = "http://example.com/place/"
var name : String = "GALERIA DOMINIKAŃSKA"
var encodedName = name.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)
var finalUrl = baseUrl + encodedName
// println(finalUrl)
// http://example.com/place/GALERIA%20DOMINIKA%C5%83SKA
[/code]