Vote count:
0
I am sending data via socket.io my app, which I want to embed the text of a parameter in a UILabel
Javascript server
socket.emit("app",{ac:"organización"})
iOS App
var ac = self.jsonOFsocket["ac"] as String
//ac === "organización"
self.label.text = ac
//self.label.text === "organizaci\U00f3n"
- The socket.io the app sends unencrypted characters.
- The app successfully receives all characters
- The app shows different symbols
I try to do this:
func utf(txt:String) -> NSString {
var newTxt = NSString(format:txt, NSUTF8StringEncoding)
newTxt.precomposedStringWithCanonicalMapping
return newTxt
}
var ac = self.jsonOFsocket["ac"] as String
//ac === "organización"
self.label.text = uft(ac)
//self.label.text === "organizaciââ¥n"
This is important:
organizaciââ¥n
asked 56 secs ago
iOS: How to display special characters in Swift [NSString]
Aucun commentaire:
Enregistrer un commentaire