0

I was send data with socket. But some character didn't convert utf8. I use this code when sending data

let message:String = self._messagesQueue[0]
let data = message.data(using: String.Encoding.utf8)!
let bytesWritten = data.withUnsafeBytes { self.outputStream?.write($0, maxLength: data.count) }

some character which "ş","ğ","ü" are displaying as "Å" How to fix it this text ?

4
  • Maybe try using unicode instead of utf8... Commented Feb 13, 2017 at 7:45
  • 2
    Your code is ok. It writes proper UTF-8 data. If there is a problem, it's on the receipient side. Commented Feb 13, 2017 at 7:48
  • @SwiftDeveloper: That question is about NSAttributedString, I don't think it is related to this problem. Commented Feb 13, 2017 at 8:32
  • You are right. The problem was on the recipient side. Thank you @Codo Commented Feb 13, 2017 at 8:33

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.