Android Question Problem trying to write to socket bytes with some values greater then chr(128)

Enrico Fuoti

Active Member
Licensed User
Longtime User
Hi all,
my problem is to write to a wifi socket connected to a led display.
The Display accepts a 22 byte string, but some of the required chars are chr(177) to chr(186).
When I assign the string to buffer the buffer of course gets negative values.. and the display will not generate any output.
Any suggestion?
B4X:
Sub writeTotemString(ps_message As String)
    Dim buffer() As Byte = ps_message.GetBytes("UTF8")
    astreamTotem.Write(buffer)
End Sub
example:
Buffer(3) : -62 (0xFFFFFFC2)
 

Enrico Fuoti

Active Member
Licensed User
Longtime User
Sorry, disregard... it works even with the negative numbers... I just changed the charset to ISO-8859-1..
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…