Post

Replies

Boosts

Views

Activity

URL Encoding doesn't work with iOS 17 which is working with iOS 16
We are working on URLs with special characters and also Unicode characters and it is not working with iOS 17 which was working fine with iOS 16 and below iOS versions For example, URL consists of symbols like @&₹, and URL encoding provides the same output for both iOS 17 and 16 versions but the URL getting failed with the following error Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={NSErrorFailingURLStringKey=http://192.168.1/api/rest/contents/Shan%27s%20iPhone%20%40%24%E2%82%B9/test.jpg, NSErrorFailingURLKey=http://192.168.1/api/rest/contents/Shan%27s%20iPhone%20%40%24%E2%82%B9/test.jpg, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDownloadTask <140D8A75-0079-4479-ADD5-CA50077C85F0>.<1>" ), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDownloadTask <140D8A75-0079-4479-ADD5-CA50077C85F0>.<1>} Here is the function we are using to encode func urlEncode(urlPath: String) -> String? { let generalDelimitersToEncode = "#[]@" let subDelimitersToEncode = "!$&'()*+,;=" var allowedCharacterSet = CharacterSet.urlQueryAllowed allowedCharacterSet.remove(charactersIn: "\(generalDelimitersToEncode)\(subDelimitersToEncode)") return urlPath.addingPercentEncoding(withAllowedCharacters: allowedCharacterSet) } /* Input: http://192.168.1/api/rest/contents/Shan's iPhone @$₹/test.jpg Output in iOS 17: http://192.168.1/api/rest/contents/Shan%27s%20iPhone%20%40%24%E2%82%B9/test.jpg Output in iOS 16 and below: http://192.168.1/api/rest/contents/Shan%27s%20iPhone%20%40%24%E2%82%B9/test.jpg */ Question: Is there a way to hanle this in iOS 17 ?
12
6
5.9k
Sep ’23