I have a string in swift:
let flag = "Cattì ò"
I am trying to convert the UTF8 symbols.
I have tried using
stringByRemovingPercentEncoding
but noting changes. How can I convert the symbols properly ?
I have a string in swift:
let flag = "Cattì ò"
I am trying to convert the UTF8 symbols.
I have tried using
stringByRemovingPercentEncoding
but noting changes. How can I convert the symbols properly ?
Copyright © 2021 Jogjafile Inc.
Welcome to the encoding guessing game! Look like somewhere along the pathway, your string didn't get the correct code page. Here's one way to guess it:
The array contains all the encodings that Cocoa supports.
From the results, it seems like your string was encoded in
NSISOLatin1StringEncoding(a.k.a ISO-8859-1), the default encoding for HTML 4.01. This givesCattì òin UTF-8, not exactly match your desired result but is the closest among all code pages.Other good candidates are
NSWindowsCP1252StringEncodingandNSWindowsCP1254StringEncodingso I'd suggest you check with other strings.