Sub AppStart (Form1 As Form, Args() As String)
Dim txt As String = "foo"
Dim res As String = ""
For Each b As Byte In txt.GetBytes("UTF8")
res = res & NumberFormat2(ToBinaryString(Bit.And(0xff, b)), 8, 0, 0, False)' & " "
Next
Log(res)
ToString(res)
End Sub
Sub ToString(bin As String) As String
Dim v As Int
Dim o As String
For x=0 To bin.Length-1
If bin.CharAt(bin.Length-1-x)="1" Then v=v+Power(2,x)
Next
For x=0 To bin.Length/8-1
o=Chr(Bit.And(Bit.ShiftRight(v,x*8),255)) & o
Next
Log(o)
End Sub