SwiftSocket icon indicating copy to clipboard operation
SwiftSocket copied to clipboard

how can i read data in string formate

Open Fareeha-Naz opened this issue 4 years ago • 1 comments

Hi daer! How can i read data in string formate.... tell me any work around bacouse my server is sending back data in string formate... its urgent please please give me responce as soon as possible

Fareeha-Naz avatar Aug 19 '21 06:08 Fareeha-Naz

Any sort of information you receive is byte formatted. Since a UTF-8 character is 4 bytes in length (32bits), you can turn those bytes into UTF-8 characters. You can do it when creating a string object:

String(bytes: bytes, encoding: .utf8)

martppa avatar Sep 03 '22 18:09 martppa