Imports System
Imports System.Text
Imports Microsoft.VisualBasic.Strings
Class MainClass
Public Shared Sub Main()
Dim bytes() As Byte
Dim chars() As Char = {ChrW(35), ChrW(37), ChrW(38), ChrW(928), ChrW(931)}
Dim uni As New UnicodeEncoding()
Dim byteCount As Integer = uni.GetByteCount(chars, 1, 2)
bytes = New Byte(byteCount - 1) {}
Dim bytesEncodedCount As Integer = uni.GetBytes(chars, 1, 2, bytes, 0)
Console.WriteLine(bytesEncodedCount)
Dim b As Byte
For Each b In bytes
Console.WriteLine(b)
Next b
End Sub
End Class
|