Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27184

VS 2010 ASCII to Hex

$
0
0
I'm currently using the following code, but it won't convert "advanced ASCII", such as: ™ ¥ © etc...
It just gives them a question mark value (3F).

How can I make it convert them correctly?

Code:

        Dim str As String = TextBox1.Text
        Dim bytes() As Byte
        Dim hexn As System.Text.StringBuilder = New System.Text.StringBuilder
        bytes = System.Text.ASCIIEncoding.ASCII.GetBytes(str)
        For i As Integer = 0 To bytes.Length - 1
            hexn.Append(bytes(i).ToString("x"))
        Next
        TextBox2.AppendText((hexn.ToString()))


Viewing all articles
Browse latest Browse all 27184

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>