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

Discussion in 'Android Questions' started by Enrico Fuoti, Jun 3, 2019.

  1. Enrico Fuoti

    Enrico Fuoti Member Licensed 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?
    Code:
    Sub writeTotemString(ps_message As String)
        
    Dim buffer() As Byte = ps_message.GetBytes("UTF8")
        astreamTotem.Write(buffer)
    End Sub
    example:
    Buffer(3) : -62 (0xFFFFFFC2)
     
  2. Enrico Fuoti

    Enrico Fuoti Member Licensed User

    Sorry, disregard... it works even with the negative numbers... I just changed the charset to ISO-8859-1..
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice