I do some easy tasks with Firebase, set image url
into json
, download it and show it. But for some reason if the url
contains umlauts e.g(ö, ä, ü etc..) the url is set to wrong section.
Edit: I gotta clarify that I do the percent encoding with the url. So it actually doesn't contain any umlauts.
So the url
actually looks like this for example for Göteborgs Rapé Loose.png
: https://firebasestorage.googleapis.com/v0/b/snuspedia.appspot.com/o/Go%CC%88teborgs%20Rape%CC%81%20Loose.png?alt=media&token=e8f2219b-d14e-46f6-a90f-ee21f912af6c
With umlaut it does like this:
And without umlauts it does correct like this:
This is how I do all these steps what I described:
if productsValue[indexPath.row]["productUrl"] != nil {
cell.snusProductImageView!.kf_setImageWithURL(NSURL(string: productsValue[indexPath.row]["productUrl"] as! String)!)
}
else {
let productImageref = productsValue[indexPath.row]["Products"] as! String
let decomposedPath = productImageref.decomposedStringWithCanonicalMapping
cell.snusProductImageView.image = nil
cell.snusProductImageView.kf_showIndicatorWhenLoading = true
FIRStorage.storage().reference().child("\(decomposedPath).png").downloadURLWithCompletion({(url, error)in
FIRDatabase.database().reference().child("Snuses").child(decomposedPath).child("productUrl").setValue(url!.absoluteString)
let resource = Resource(downloadURL: url!, cacheKey: decomposedPath)
cell.snusProductImageView.kf_setImageWithURL(url)
})
What is the problem, can you tell me? I've been searching the problem for a good week.