Encoding issue. Convert to lisible string

49 Views Asked by At

I have a little issue in my project.

I fetch a JSON with strings like this "Paris 11'e8me", I want this to be displayed as "Paris 11ème".

My guess is that the string is encoded in sthg like isoLatin1. I want it to be displayed properly (utf8?)

How do I convert it ? Thanks in advance

2

There are 2 best solutions below

1
tytusprod On
let encoedString = String(utf8String: stringToDecode.cString(using: .utf8)!)
0
Максуд Даудов On

On decoding data use

String(data:dataString, encoding: .isoLatin1)

dataString is Data type