URL Encode only Unicode Characters

Make your URLs readable by the Framework SDK

When dealing with Unicode Characters in URL strings, we need to encode Unicode characters to percentages for them to be readable by URL. We do so using the following code:

// https://hashaam.com/2017/11/13/url-encode-only-unicode-characters/
let originalURLString = "https://www.exampleserver.com/articles/latest/لن-تصدق-ما-يمكن-أن-تجده-في-مطبخك-فاحذر-غسل-هذه-الأداة.html"
let allowedCharacterSet = CharacterSet.urlFragmentAllowed
let urlString = originalURLString.addingPercentEncoding(withAllowedCharacters: allowedCharacterSet)!
let url = URL(string: urlString)!