Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
URL Encode only Unicode Characters
let originalURLString = "لن-تصدق-ما-يمكن-أن-تجده-في-مطبخك-فاحذر-غسل-هذه-الأداة.html"
let allowedCharacterSet = CharacterSet.urlFragmentAllowed
let urlString = originalURLString.addingPercentEncoding(withAllowedCharacters: allowedCharacterSet)!
let url = URL(string: urlString)!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment