I need to convert an ISO-8859-1 (isoLatin1) encoded XML string to UTF-8. I tried some code I found on other questions, but most of them covers converting string to utf8 and vice-versa. I don't have any code, so none will be posted.
Sorry, to make it clear, I tried:
String(data:isoLatin1EncodedData, encoding: .uf8)
is nil
String(data:isoLatin1EncodedData, encoding: .isoLatin1)
returns the string with the wrong encoding.
String(utf8String: isoLatin1EncodedString.cString(using: String.Encoding.isoLatin1)!)
is nil
I need the string with to be converted from one encoding to another... Edit2: Sample feed - http://feeds.folha.uol.com.br/colunas/monicabergamo/rss091.xml
Not sure if this is what you are looking for:
Code:
Output: