We are using the Serial Tutorial example that uses AsyncStreams to received data via Bluetooth.
It is working fine but the data I’m receiving contains special ASCII characters which are not being received properly by my application – they are being received as 2 bytes instead of one.
I have changed the encoding from UTF8 to ISO-8859-1 but it has not fixed the issue
B4X:
Dim SaveStr As String
Dim LorStr As String
----------------------
Sub AStream_NewData (Buffer() As Byte)
LorStr = BytesToString(Buffer, 0, Buffer.Length, "ISO-8859-1")
SaveStr = SaveStr & LorStr ' Concatenate string
Save_file(SaveStr) ' Save to txt file
End Sub
Which ASCII characters are not received properly?
Do you see the same problem when the received text is shown on the screen, or is it only in the saved txt file?
The bytes listed above are a header in the data which is 8 bytes of information but when it is received via Bluetooth to any of the Android devices we have tested the header section contains extra bytes.
I'm terrible at explaining things so I apologise if this is just gibberish.