I am trying to create a percent encoded string in Swift so I can safely send text as a GET
request. I found some Objective C code which I am trying to convert to Swift. I've written the following Swift code:
CFURLCreateStringByAddingPercentEscapes(nil,
CFStringRef(encodedString), nil,
CFStringRef("/%&=?$#+-~@<>|\\*,.()[]{}^!"),
kCFStringEncodingUTF8)
There is no kCFStringEncodingUTF8
in Swift ... If you right click the CFStringEncodings
source you see there is a million things in there but no UTF8. I don't understand. How can I use the UTF8 string encoding in this situation?
EDIT : I found a way to encode a string but I still don't understand what happened to kCFStringEncodingUTF8