ok guys, never mind, the solution was actually simple all along, I could have sworn I tried it, but oh well. For anyone that might find it useful, here it is:
EDIT: Updated code.Code:Private Function BinToTxt(ByVal BinStr As String) Dim stA() As String = BinStr.Split(" "c) Dim bl As New List(Of Byte) For Each s As String In stA bl.Add(Convert.ToByte(s, 2)) Next Return Encoding.Unicode.GetString(bl.ToArray) End Function Private Function TxtToBin(ByVal Str As String) As String Dim bt() As Byte = Encoding.Unicode.GetBytes(Str.ToCharArray) Dim st As New StringBuilder For Each byt As Byte In bt st.Append(Convert.ToString(byt, 2).PadLeft(8, "0"c) & " ") Next Return st.ToString End Function 'Example usage: 'OutTxt.Text = TxtToBin(InTxt.Text) 'OutTxt.Text = BinToTxt(InTxt.Text)




Reply With Quote
