string to byte array "åäöÿ" is "????"
Hi
I have a question about byte arrays.
This is the line where it be wrong.
CODE]
Dim MyByte() As Byte = Encoding.ASCII.GetBytes(sString)
[/CODE]
if I have a ÿ in "sString" then it change it to ? it´s the same with åäö.
Do anybody now how to fix it!
plz
Tankz m00gly
Re: string to byte array "åäöÿ" is "????"
Quote:
Originally posted by m00gly
Hi
I have a question about byte arrays.
This is the line where it be wrong.
CODE]
Dim MyByte() As Byte = Encoding.ASCII.GetBytes(sString)
[/CODE]
if I have a ÿ in "sString" then it change it to ? it´s the same with åäö.
Do anybody now how to fix it!
plz
Tankz m00gly
Hmm, I remember having this problem as well! I think it has something to do with the fact that Strings in .NET use the unicode character set (each character is two bytes, not one).
I'll go find a work around!
thanks but i´ve didn´t get it to work
Hmm it didn´t work for me, my function looks like this
Code:
Public Function SendText(ByVal sValue As String, ByVal sRemoteHost As String)
Dim MyByte As Byte()
MyByte = New System.Text.UnicodeEncoding().GetBytes(sValue)
MySocket.Send(MyByte, MyByte.Length, sRemoteHost)
End Function
With this code "ÿ" will be a "square" and "å" will be "e"