Android Question problem for french accents

freedom2000

Well-Known Member
Licensed User
Longtime User
Hi All,

I am trying to send string from Android to PC VB.net. The connection is done with sockets and works very well. But all accentuated characters are replaced by "?"

example : if I want to send été (summer) I get ?t?

After having read all the forum regarding "encoding" or "getbyte" I have tried UTF-8, WINDOWS-1252 and ISO-8859-1

but no success

B4X:
Sub SendMsg2Server

    If Msg2Server.Length > 0 Then
        Dim buffer() As Byte
        buffer = Msg2Server.GetBytes("WINDOWS-1252") '("ISO-8859-1") '("UTF8")
     
            Tcp.AStreams.Write(buffer)
     
        Msg2Server = ""
 
    End If
End Sub

here is the PC side

B4X:
Private Sub OnRecieve(ByVal ar As IAsyncResult) 'when something is received from server

        Dim client As Socket = ar.AsyncState
        client.EndReceive(ar)
        Dim bytesRec As Byte() = byteData
        Dim message As String = System.Text.ASCIIEncoding.ASCII.GetString(bytesRec) 'here is the message from server

        Process(message, True)
    End Sub

Any idea please
 

freedom2000

Well-Known Member
Licensed User
Longtime User
Ok got it (I was silly to look for the solution on the android side as it was obvious on the PC side !)

B4X:
  Dim message As String = System.Text.UTF8Encoding.UTF8.GetString(bytesRec) 'here is the message from server
 
Upvote 0
Top