I'm having a lot of trouble with the encoding of my application. I have an online radio in the United States and I'm trying an application for it. I get the metadata of the LastFM songs.
let queryURL: String
if useLastFM {
queryURL = String(format: "http://ws.audioscrobbler.com/2.0/?method=track.getInfo&api_key=%@&artist=%@&track=%@&format=json", apiKey, track.artist, track.title)
} else {
queryURL = String(format: "https://itunes.apple.com/search?term=%@+%@&entity=song", track.artist, track.title)
}
let escapedURL = queryURL.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
It says the CENTOVA that sends in UTF8, but not to being able to solve that.
When I use:
@IBAction func testeS(_ sender: Any) {
let musica = self.track.title
print(musica)
}
I get output like this:
Direção do vento Part César Menotti
I've tried it anyway, but I assume I do not have full control of Swift, I'm studying! Thanks to anyone who has read / helped / contributed to my question.