behnam27 behnam27 - 1 month ago 3
Swift Question

Convert UInt8 to character UTF8

My code for converting UInt8 to character is:

for item in array {
print(Character(UnicodeScalar(item)))
}


the data in array is:

[10, 0, 0, 0, 2, 0, 0, 0, 105, 100, 14, 0, 0, 0, 106, 97, 118, 97, 46, 108, 97, 110, 103, 46, 76, 111, 110, 103, 1, 0, 0, 0, 97, 17, 0, 0, 0, 106, 97, 118, 97, 46, 108, 97, 110, 103, 46, 73, 110, 116, 101, 103, 101, 114, 1, 0, 0, 0, 98, 17, 0, 0, 0, 106, 97, 118, 97, 46, 108, 97, 110, 103, 46, 73, 110, 116, 101, 103, 101, 114, 1, 0, 0, 0, 99, 2, 0, 0, 0, 91, 66, 1, 0, 0, 0, 100, 2, 0, 0, 0, 91, 66, 1, 0, 0, 0, 102, 2, 0, 0, 0, 91, 66, 1, 0, 0, 0, 101, 17, 0, 0, 0, 106, 97, 118, 97, 46, 108, 97, 110, 103, 46, 66, 111, 111, 108, 101, 97, 110, 9, 0, 0, 0, 116, 121, 112, 101, 95, 99, 111, 100, 101, 17, 0, 0, 0, 106, 97, 118, 97, 46, 108, 97, 110, 103, 46, 73, 110, 116, 101, 103, 101, 114, 8, 0, 0, 0, 103, 114, 111, 117, 112, 95, 105, 100, 17, 0, 0, 0, 106, 97, 118, 97, 46, 108, 97, 110, 103, 46, 73, 110, 116, 101, 103, 101, 114, 10, 0, 0, 0, 103, 114, 111, 117, 112, 95, 99, 111, 100, 101, 17, 0, 0, 0, 106, 97, 118, 97, 46, 108, 97, 110, 103, 46, 73, 110, 116, 101, 103, 101, 114, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 55, 0, 1, 0, 0, 0, 1, 0, 0, 0, 49, 0, 2, 0, 0, 0, 3, 0, 0, 0, 51, 49, 48, 0, 3, 0, 0, 0, 21, 0, 0, 0, 216, 167, 216, 180, 216, 174, 216, 167, 216, 181, 32, 216, 170, 216, 172, 216, 167, 216, 177, 219, 140, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 51, 49, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 49, 0, 9, 0, 0, 0, 1, 0, 0, 0, 48, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 54, 49, 0, 1, 0, 0, 0, 1, 0, 0, 0, 50, 0, 2, 0, 0, 0, 3, 0, 0, 0, 51, 50, 48, 0, 3, 0, 0, 0, 28, 0, 0, 0, 216, 167, 216, 180, 216, 174, 216, 167, 216, 181, 32, 216, 186, 217, 138, 216, 177, 32, 216, 170, 216, 172, 216, 167, 216, 177, 219, 140, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 51, 50, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 49, 0, 9, 0, 0, 0, 1, 0, 0, 0, 48, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 49, 0, 1, 0, 0, 0, 1, 0, 0, 0, 51, 0, 2, 0, 0, 0, 3, 0, 0, 0, 51, 51, 48, 0, 3, 0, 0, 0, 19, 0, 0, 0, 216, 172, 216, 167, 216, 177, 219, 140, 32, 216, 180, 216, 177, 217, 131, 216, 167, 216, 161, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 51, 51, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 49, 0, 9, 0, 0, 0, 1, 0, 0, 0, 48, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 53, 57, 0, 1, 0, 0, 0, 1, 0, 0, 0, 52, 0, 2, 0, 0, 0, 3, 0, 0, 0, 55, 54, 48, 0, 3, 0, 0, 0, 60, 0, 0, 0, 216, 179, 216, 167, 217, 138, 216, 177, 32, 216, 173, 216, 179, 216, 167, 216, 168, 226, 128, 140, 217, 135, 216, 167, 219, 140, 32, 216, 175, 216, 177, 217, 138, 216, 167, 217, 129, 216, 170, 217, 134, 219, 140, 47, 217, 190, 216, 177, 216, 175, 216, 167, 216, 174, 216, 170, 217, 134, 219, 140, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 55, 54, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 49, 0, 9, 0, 0, 0, 1, 0, 0, 0, 48, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 53, 56, 0, 1, 0, 0, 0, 1, 0, 0, 0, 53, 0, 2, 0, 0, 0, 3, 0, 0, 0, 49, 49, 48, 0, 3, 0, 0, 0, 10, 0, 0, 0, 216, 181, 217, 134, 216, 175, 217, 136, 217, 130, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 49, 49, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 50, 0, 9, 0, 0, 0, 1, 0, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 55, 54, 0, 1, 0, 0, 0, 1, 0, 0, 0, 54, 0, 2, 0, 0, 0, 3, 0, 0, 0, 49, 48, 48, 0, 3, 0, 0, 0, 4, 0, 0, 0, 116, 101, 115, 116, 0, 4, 0, 0, 0, 4, 0, 0, 0, 116, 101, 115, 116, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 49, 50, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 50, 0, 9, 0, 0, 0, 1, 0, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 51, 50, 0, 1, 0, 0, 0, 1, 0, 0, 0, 54, 0, 2, 0, 0, 0, 3, 0, 0, 0, 49, 50, 48, 0, 3, 0, 0, 0, 28, 0, 0, 0, 216, 167, 216, 179, 217, 134, 216, 167, 216, 175, 32, 217, 134, 216, 178, 216, 175, 32, 216, 181, 217, 134, 216, 175, 217, 136, 217, 130, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 49, 50, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 50, 0, 9, 0, 0, 0, 1, 0, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 56, 0, 1, 0, 0, 0, 1, 0, 0, 0, 55, 0, 2, 0, 0, 0, 3, 0, 0, 0, 49, 51, 48, 0, 3, 0, 0, 0, 23, 0, 0, 0, 216, 170, 217, 134, 216, 174, 217, 136, 216, 167, 217, 135, 32, 218, 175, 216, 177, 216, 175, 216, 167, 217, 134, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 49, 51, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 50, 0, 9, 0, 0, 0, 1, 0, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 55, 51, 0, 1, 0, 0, 0, 1, 0, 0, 0, 56, 0, 2, 0, 0, 0, 3, 0, 0, 0, 50, 49, 48, 0, 3, 0, 0, 0, 8, 0, 0, 0, 216, 168, 216, 167, 217, 134, 217, 131, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 50, 49, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 50, 0, 9, 0, 0, 0, 1, 0, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 53, 52, 0, 1, 0, 0, 0, 1, 0, 0, 0, 57, 0, 2, 0, 0, 0, 3, 0, 0, 0, 50, 50, 48, 0, 3, 0, 0, 0, 51, 0, 0, 0, 216, 167, 216, 179, 217, 134, 216, 167, 216, 175, 32, 216, 175, 216, 177, 32, 216, 172, 216, 177, 217, 138, 216, 167, 217, 134, 32, 217, 136, 216, 181, 217, 136, 217, 132, 32, 217, 134, 216, 178, 216, 175, 32, 216, 168, 216, 167, 217, 134, 217, 131, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 50, 50, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 50, 0, 9, 0, 0, 0, 1, 0, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 53, 53, 0, 1, 0, 0, 0, 2, 0, 0, 0, 49, 48, 0, 2, 0, 0, 0, 3, 0, 0, 0, 51, 49, 48, 0, 3, 0, 0, 0, 40, 0, 0, 0, 216, 167, 216, 180, 216, 174, 216, 167, 216, 181, 32, 216, 170, 216, 172, 216, 167, 216, 177, 219, 140, 32, 40, 216, 175, 216, 177, 217, 138, 216, 167, 217, 129, 216, 170, 217, 134, 219, 140, 41, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 51, 49, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 50, 0, 9, 0, 0, 0, 1, 0, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 49, 53, 0, 1, 0, 0, 0, 2, 0, 0, 0, 49, 49, 0, 2, 0, 0, 0, 3, 0, 0, 0, 51, 50, 48, 0, 3, 0, 0, 0, 47, 0, 0, 0, 216, 167, 216, 180, 216, 174, 216, 167, 216, 181, 32, 216, 186, 217, 138, 216, 177, 32, 216, 170, 216, 172, 216, 167, 216, 177, 219, 140, 32, 40, 216, 175, 216, 177, 217, 138, 216, 167, 217, 129, 216, 170, 217, 134, 219, 140, 41, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 51, 50, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 50, 0, 9, 0, 0, 0, 1, 0, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 54, 55, 0, 1, 0, 0, 0, 2, 0, 0, 0, 49, 50, 0, 2, 0, 0, 0, 3, 0, 0, 0, 51, 51, 48, 0, 3, 0, 0, 0, 38, 0, 0, 0, 216, 172, 216, 167, 216, 177, 219, 140, 32, 216, 180, 216, 177, 217, 131, 216, 167, 216, 161, 32, 40, 216, 175, 216, 177, 217, 138, 216, 167, 217, 129, 216, 170, 217, 134, 219, 140, 41, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 51, 51, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 50, 0, 9, 0, 0, 0, 1, 0, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 50, 56, 0, 1, 0, 0, 0, 2, 0, 0, 0, 49, 51, 0, 2, 0, 0, 0, 3, 0, 0, 0, 52, 49, 48, 0, 3, 0, 0, 0, 34, 0, 0, 0, 217, 133, 217, 136, 216, 172, 217, 136, 216, 175, 219, 140, 32, 217, 131, 216, 167, 217, 132, 216, 167, 219, 140, 32, 216, 185, 217, 133, 217, 136, 217, 133, 219, 140, 0, 4, 0, 0, 0, 25, 0, 0, 0, 217, 133, 46, 32, 217, 131, 216, 167, 217, 132, 216, 167, 219, 140, 32, 216, 185, 217, 133, 217, 136, 217, 133, 219, 140, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 52, 49, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 50, 0, 9, 0, 0, 0, 1, 0, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 49, 56, 0, 1, 0, 0, 0, 2, 0, 0, 0, 50, 49, 0, 2, 0, 0, 0, 3, 0, 0, 0, 55, 49, 48, 0, 3, 0, 0, 0, 28, 0, 0, 0, 217, 190, 217, 138, 216, 180, 226, 128, 140, 217, 190, 216, 177, 216, 175, 216, 167, 216, 174, 216, 170, 226, 128, 140, 217, 135, 216, 167, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 55, 49, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 50, 0, 9, 0, 0, 0, 1, 0, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 52, 54, 0, 1, 0, 0, 0, 2, 0, 0, 0, 50, 50, 0, 2, 0, 0, 0, 3, 0, 0, 0, 55, 50, 48, 0, 3, 0, 0, 0, 43, 0, 0, 0, 216, 179, 217, 129, 216, 167, 216, 177, 216, 180, 216, 167, 216, 170, 32, 217, 131, 216, 167, 217, 132, 216, 167, 32, 217, 136, 32, 216, 167, 216, 185, 216, 170, 216, 168, 216, 167, 216, 177, 216, 167, 216, 170, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 55, 50, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 50, 0, 9, 0, 0, 0, 1, 0, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 50, 0, 1, 0, 0, 0, 2, 0, 0, 0, 50, 51, 0, 2, 0, 0, 0, 3, 0, 0, 0, 55, 51, 48, 0, 3, 0, 0, 0, 40, 0, 0, 0, 217, 131, 216, 167, 216, 177, 32, 216, 175, 216, 177, 32, 216, 172, 216, 177, 217, 138, 216, 167, 217, 134, 32, 217, 190, 216, 177, 217, 136, 218, 152, 217, 135, 226, 128, 140, 217, 135, 216, 167, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 55, 51, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 50, 0, 9, 0, 0, 0, 1, 0, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 52, 50, 0, 1, 0, 0, 0, 2, 0, 0, 0, 50, 52, 0, 2, 0, 0, 0, 3, 0, 0, 0, 55, 52, 48, 0, 3, 0, 0, 0, 55, 0, 0, 0, 216, 179, 216, 177, 217, 133, 216, 167, 217, 138, 217, 135, 226, 128, 140, 218, 175, 216, 176, 216, 167, 216, 177, 219, 140, 32, 216, 175, 216, 177, 32, 216, 179, 216, 167, 217, 138, 216, 177, 32, 216, 180, 216, 177, 217, 131, 216, 170, 226, 128, 140, 217, 135, 216, 167, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 55, 52, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 50, 0, 9, 0, 0, 0, 1, 0, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 51, 54, 0, 1, 0, 0, 0, 2, 0, 0, 0, 50, 53, 0, 2, 0, 0, 0, 3, 0, 0, 0, 55, 53, 48, 0, 3, 0, 0, 0, 31, 0, 0, 0, 217, 136, 216, 175, 216, 167, 217, 138, 216, 185, 32, 217, 136, 32, 216, 179, 217, 190, 216, 177, 216, 175, 217, 135, 226, 128, 140, 217, 135, 216, 167, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 55, 53, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 50, 0, 9, 0, 0, 0, 1, 0, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 50, 48, 0, 1, 0, 0, 0, 2, 0, 0, 0, 50, 54, 0, 2, 0, 0, 0, 3, 0, 0, 0, 55, 54, 48, 0, 3, 0, 0, 0, 79, 0, 0, 0, 216, 179, 216, 167, 217, 138, 216, 177, 32, 216, 173, 216, 179, 216, 167, 216, 168, 226, 128, 140, 217, 135, 216, 167, 219, 140, 32, 216, 175, 216, 177, 217, 138, 216, 167, 217, 129, 216, 170, 217, 134, 219, 140, 47, 217, 190, 216, 177, 216, 175, 216, 167, 216, 174, 216, 170, 217, 134, 219, 140, 32, 40, 216, 175, 216, 177, 217, 138, 216, 167, 217, 129, 216, 170, 217, 134, 219, 140, 41, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 55, 54, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 50, 0, 9, 0, 0, 0, 1, 0, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 49, 50, 0, 1, 0, 0, 0, 2, 0, 0, 0, 50, 55, 0, 2, 0, 0, 0, 3, 0, 0, 0, 56, 49, 48, 0, 3, 0, 0, 0, 39, 0, 0, 0, 216, 179, 216, 167, 217, 138, 216, 177, 32, 216, 175, 216, 167, 216, 177, 216, 167, 216, 166, 219, 140, 226, 128, 140, 217, 135, 216, 167, 219, 140, 32, 216, 172, 216, 167, 216, 177, 219, 140, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 56, 49, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 50, 0, 9, 0, 0, 0, 1, 0, 0, 0, 49, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 55, 50, 0, 1, 0, 0, 0, 2, 0, 0, 0, 50, 56, 0, 2, 0, 0, 0, 3, 0, 0, 0, 49, 49, 48, 0, 3, 0, 0, 0, 35, 0, 0, 0, 216, 167, 217, 133, 217, 136, 216, 167, 217, 132, 32, 217, 136, 32, 217, 133, 216, 167, 216, 180, 217, 138, 217, 134, 226, 128, 140, 216, 162, 217, 132, 216, 167, 216, 170, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 49, 49, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 51, 0, 9, 0, 0, 0, 1, 0, 0, 0, 50, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 49, 52, 0, 1, 0, 0, 0, 2, 0, 0, 0, 50, 57, 0, 2, 0, 0, 0, 3, 0, 0, 0, 49, 50, 48, 0, 3, 0, 0, 0, 48, 0, 0, 0, 216, 175, 216, 167, 216, 177, 216, 167, 216, 166, 219, 140, 226, 128, 140, 217, 135, 216, 167, 219, 140, 32, 216, 175, 216, 177, 32, 216, 172, 216, 177, 217, 138, 216, 167, 217, 134, 32, 216, 170, 217, 131, 217, 133, 217, 138, 217, 132, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 49, 50, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 51, 0, 9, 0, 0, 0, 1, 0, 0, 0, 50, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 50, 49, 0, 1, 0, 0, 0, 2, 0, 0, 0, 51, 48, 0, 2, 0, 0, 0, 3, 0, 0, 0, 49, 51, 48, 0, 3, 0, 0, 0, 46, 0, 0, 0, 217, 133, 216, 174, 216, 167, 216, 177, 216, 172, 32, 217, 130, 216, 168, 217, 132, 32, 216, 167, 216, 178, 32, 216, 168, 217, 135, 216, 177, 217, 135, 226, 128, 140, 216, 168, 216, 177, 216, 175, 216, 167, 216, 177, 219, 140, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 49, 51, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 51, 0, 9, 0, 0, 0, 1, 0, 0, 0, 50, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 55, 48, 0, 1, 0, 0, 0, 2, 0, 0, 0, 51, 49, 0, 2, 0, 0, 0, 3, 0, 0, 0, 50, 49, 48, 0, 3, 0, 0, 0, 50, 0, 0, 0, 216, 179, 216, 177, 217, 133, 216, 167, 217, 138, 217, 135, 226, 128, 140, 218, 175, 216, 176, 216, 167, 216, 177, 219, 140, 226, 128, 140, 217, 135, 216, 167, 219, 140, 32, 216, 168, 217, 132, 217, 134, 216, 175, 32, 217, 133, 216, 175, 216, 170, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 50, 49, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 51, 0, 9, 0, 0, 0, 1, 0, 0, 0, 50, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 49, 55, 0, 1, 0, 0, 0, 2, 0, 0, 0, 51, 50, 0, 2, 0, 0, 0, 3, 0, 0, 0, 51, 49, 48, 0, 3, 0, 0, 0, 39, 0, 0, 0, 216, 179, 216, 167, 217, 138, 216, 177, 32, 216, 175, 216, 167, 216, 177, 216, 167, 216, 166, 219, 140, 226, 128, 140, 217, 135, 216, 167, 219, 140, 32, 216, 171, 216, 167, 216, 168, 216, 170, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 51, 49, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 51, 0, 9, 0, 0, 0, 1, 0, 0, 0, 50, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 51, 48, 0, 1, 0, 0, 0, 2, 0, 0, 0, 51, 51, 0, 2, 0, 0, 0, 3, 0, 0, 0, 49, 49, 48, 0, 3, 0, 0, 0, 25, 0, 0, 0, 216, 173, 217, 130, 32, 216, 167, 217, 132, 216, 167, 217, 133, 216, 170, 217, 138, 216, 167, 216, 178, 217, 135, 216, 167, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 49, 49, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 52, 0, 9, 0, 0, 0, 1, 0, 0, 0, 51, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 53, 55, 0, 1, 0, 0, 0, 2, 0, 0, 0, 51, 52, 0, 2, 0, 0, 0, 3, 0, 0, 0, 50, 49, 48, 0, 3, 0, 0, 0, 17, 0, 0, 0, 216, 173, 217, 130, 32, 216, 179, 216, 177, 217, 130, 217, 129, 217, 132, 219, 140, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 50, 49, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 52, 0, 9, 0, 0, 0, 1, 0, 0, 0, 51, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 52, 52, 0, 1, 0, 0, 0, 2, 0, 0, 0, 51, 53, 0, 2, 0, 0, 0, 3, 0, 0, 0, 49, 49, 48, 0, 3, 0, 0, 0, 36, 0, 0, 0, 216, 167, 216, 179, 217, 134, 216, 167, 216, 175, 32, 217, 190, 216, 177, 216, 175, 216, 167, 216, 174, 216, 170, 217, 134, 219, 140, 32, 216, 168, 216, 167, 217, 134, 217, 131, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 49, 49, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 53, 0, 9, 0, 0, 0, 1, 0, 0, 0, 52, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 54, 53, 0, 1, 0, 0, 0, 2, 0, 0, 0, 51, 54, 0, 2, 0, 0, 0, 3, 0, 0, 0, 49, 50, 48, 0, 3, 0, 0, 0, 52, 0, 0, 0, 217, 136, 216, 167, 217, 133, 226, 128, 140, 217, 135, 216, 167, 219, 140, 32, 217, 190, 216, 177, 216, 175, 216, 167, 216, 174, 216, 170, 217, 134, 219, 140, 32, 217, 131, 217, 136, 216, 170, 216, 167, 217, 135, 226, 128, 140, 217, 133, 216, 175, 216, 170, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 49, 50, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 53, 0, 9, 0, 0, 0, 1, 0, 0, 0, 52, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 51, 52, 0, 1, 0, 0, 0, 2, 0, 0, 0, 51, 55, 0, 2, 0, 0, 0, 3, 0, 0, 0, 49, 51, 48, 0, 3, 0, 0, 0, 66, 0, 0, 0, 216, 173, 216, 181, 217, 135, 32, 216, 172, 216, 167, 216, 177, 219, 140, 32, 217, 136, 216, 167, 217, 133, 226, 128, 140, 217, 135, 216, 167, 219, 140, 32, 217, 190, 216, 177, 216, 175, 216, 167, 216, 174, 216, 170, 217, 134, 219, 140, 32, 216, 168, 217, 132, 217, 134, 216, 175, 226, 128, 140, 217, 133, 216, 175, 216, 170, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 49, 51, 48, 0, 8, 0, 0, 0, 1, 0, 0, 0, 53, 0, 9, 0, 0, 0, 1, 0, 0, 0, 52, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 51, 55, 0, 1, 0, 0, 0, 2, 0, 0, 0, 51, 56, 0, 2, 0, 0, 0, 3, 0, 0, 0, 50, 49, 48, 0, 3, 0, 0, 0, 41, 0, 0, 0, 217, 190, 217, 138, 216, 180, 226, 128, 140, 216, 175, 216, 177, 217, 138, 216, 167, 217, 129, 216, 170, 32, 216, 167, 216, 178, 32, 217, 133, 216, 180, 216, 170, 216, 177, 217, 138, 216, 167, 217, 134, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 135, 226, 128, 140, 216, 180, 216, 175, 217, 135, 0, 4, 0, 0, 0, 45, 0, 0, 0, 216, 168, 217, 135, 46, 32, 217, 129, 46, 32, 216, 167, 217, 133, 217, 136, 216, 167, 217, 132, 32, 217, 136, 32, 217, 133, 216, 167, 216, 180, 217, 138, 217, 134, 226, 128, 140, 216, 162, 217, 132, 216, 167, 216, 170, 0, 6, 216, 168, 217, 135, 216, 167, 219, 140, 226, 128, 140, 216, 170, 217, 133, 216, 167, 217, 133, 226, 128, 140, 216, 180, 216, 175, 217, 135, 226, 128, 140, 219, 140, 32, 216, 179, 216, 177, 217, 133, 216, 167, 217, 138, 217, 135, 226, 128, 140, 218, 175, 216, 176, 216, 167, 216, 177, 219, 140, 226, 128, 140, 128, 140, 218, 175, 216, 176, 216, 167, 216, 177, 219, 140, 226, 128, 140, 217, 135, 216, 167, 219, 140, 32, 216, 168, 217, 132, 217, 134, 216, 135, 216, 167, 219, 140, 32, 216, 167, 217, 134, 216, 170, 216, 184, 216, 167, 217, 133, 219, 140, 0, 0, 216, 183, 216, 177, 217, 129, 32, 216, 173, 216, 179, 216, 167, 216, 168, 226, 128, 140, 217, 135, 216, 167, 219, 140, 32, 216, 167, 217, 134, 216, 170, 216, 184, 216, 167, 217, 133, 219, 140, 0, 6, 0, 0, 0, 5, 0, 0, 0, 102, 97, 108, 115, 101, 0, 7, 0, 0, 0, 3, 0, 0, 0, 55, 50, 48, 0, 8, 0, 0, 0, 2, 0, 0, 0, 49, 48, 0, 9, 0, 0, 0, 1, 0, 0, 0, 57, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 54, 51, 0, 1, 0, 0, 0, 2, 0, 0, 0, 55, 53, 0, 2, 0, 0, 0, 3, 0, 0, 0, 51, 49, 48, 0, 3, 0, 0, 0, 59, 0, 0, 0, 216, 168, 216, 177, 218, 175, 216, 180, 216, 170, 32, 216, 167, 216, 178, 32, 217, 129, 216, 177, 217, 136, 216, 180, 32, 217, 133, 217, 136, 216, 172, 217, 136, 216, 175, 219, 140, 32, 217, 131, 216, 167, 217, 132, 216, 167, 219, 140, 32, 216, 185, 217, 133, 217, 136, 217, 133, 219, 140, 0, 4, 0, 0, 0, 33, 0, 0, 0, 216, 168, 46, 32, 217, 129, 46, 32, 217, 133, 46, 32, 217, 131, 216, 167, 217, 132, 216, 167, 219, 140, 1]


and result should be:
1310 ریتجاfalse31010612320اشخ غ تریfalse3201013330جای


but i get result like:
1310 ÙÙÙfalse31010612320ÙÙÙÙÙfalse3201013330ÙÙÙ


It works for English characters but for character in Persian language it is not working. Any body can help me?

Answer

You're converting each byte separately to the string, while UTF-8 is multibyte encoding, only characters that could be represented are 0-127(0x00-0x7f) characters from old ASCII table (numbers, basic latin characters, etc.), other characters will be encoded using 2-4 bytes.

So, UInt8 sequence should be converted using code like this:

let data = Data(bytes: array)
let string = String(data: data, encoding: .utf8)