I have some user input that needs to be sent to an HTTP-API which expects ISO-8859-15 (Latin-9) encoding. I use Alamofire to contact the API. The user input is a normal UTF-8 String (named "text" in this case):
let parameters: [String: String] = [
...
"message": String(data: text.data(using: .windowsCP1252)!, encoding: .windowsCP1252)!,
...
]
session.request("URL", method: .post, parameters: parameters).validate().responseString { response in
...
}
I tried a few of the available encodings (.isoLatin1, .isoLatin2, windowsCP1252, windowsCP1250) but none seems to work correctly (for german characters like ö, ä and ü).
Any ideas? Thanks in advance for any tips.