I have these lines in my ios app developed on xcode 12.5 using swift:
var urlString = "https://www.weather.ca/?polygon=CZWG|fir|1621169170407"
let url = URL(string: urlString)
The problem is that url returns nil. If I remove the | characters the url looks right (identical to urlString).
Any idea how I can use the "|" character in the URL?
I tried the following code but the JSON returned is different so I don't think this data source handles "|" character the same as "%7c"
let urlString = "https://www.weather.ca/?polygon=CZWG|fir|1621169170407"
let csCopy = CharacterSet(bitmapRepresentation: CharacterSet.urlPathAllowed.bitmapRepresentation)
var urlString2 = urlString2.addingPercentEncoding(withAllowedCharacters: csCopy)
let url = URL(string: urlString2!)