Imports System
Imports System.Text
Imports Microsoft.VisualBasic.Strings
Class UTF8EncodingExample
Public Shared Sub Main()
Dim chars() As Char = {ChrW(35), ChrW(37), ChrW(8), ChrW(930)}
Dim utf8 As New UTF8Encoding()
Dim byteCount As Integer = utf8.GetByteCount(chars, 1, 2)
Console.WriteLine("{0} bytes needed to encode characters.", byteCount)
End Sub
End Class
|