You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CBOR Swift does not support Unicode languages and to solve this problem you should implement as follows:
In "Extensions" :
public var ascii_bytes: [UInt8] {
// To supporting unicode languages it should return with .utf8 encoding
return self.data(using: .ascii)?.bytes ?? self.data(using: .utf8)!.bytes
}
In "Encoder":
@objc override func encode() -> String {
// To support Unicode languages, the string encoding must be specified before giving the string length
let asciiBytes = self.ascii_bytes
let encodedArray = Encoder.prepareByteArray(major: .major3, measure: asciiBytes.count)
let headerData = Data(bytes: encodedArray).binary_decimal.hex
let strData = Data(bytes: asciiBytes).hexString
return headerData.appending(strData)
}
The text was updated successfully, but these errors were encountered:
CBOR Swift does not support Unicode languages and to solve this problem you should implement as follows:
In "Extensions" :
In "Encoder":
The text was updated successfully, but these errors were encountered: