本文整理匯總了VB.NET中System.Text.Encoding.CodePage屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET Encoding.CodePage屬性的具體用法?VB.NET Encoding.CodePage怎麽用?VB.NET Encoding.CodePage使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Text.Encoding
的用法示例。
在下文中一共展示了Encoding.CodePage屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Main
' 導入命名空間
Imports System.Text
Public Class SamplesEncoding
Public Shared Sub Main()
' Print the header.
Console.Write("Name ")
Console.Write("CodePage ")
Console.Write("BodyName ")
Console.Write("HeaderName ")
Console.Write("WebName ")
Console.WriteLine("Encoding.EncodingName")
' For every encoding, compare the name properties with EncodingInfo.Name.
' Display only the encodings that have one or more different names.
Dim ei As EncodingInfo
For Each ei In Encoding.GetEncodings()
Dim e As Encoding = ei.GetEncoding()
If ei.Name <> e.BodyName OrElse ei.Name <> e.HeaderName OrElse ei.Name <> e.WebName Then
Console.Write("{0,-18} ", ei.Name)
Console.Write("{0,-9} ", e.CodePage)
Console.Write("{0,-18} ", e.BodyName)
Console.Write("{0,-18} ", e.HeaderName)
Console.Write("{0,-18} ", e.WebName)
Console.WriteLine("{0} ", e.EncodingName)
End If
Next ei
End Sub
End Class
輸出:
Name CodePage BodyName HeaderName WebName Encoding.EncodingName shift_jis 932 iso-2022-jp iso-2022-jp shift_jis Japanese (Shift-JIS) windows-1250 1250 iso-8859-2 windows-1250 windows-1250 Central European (Windows) windows-1251 1251 koi8-r windows-1251 windows-1251 Cyrillic (Windows) Windows-1252 1252 iso-8859-1 Windows-1252 Windows-1252 Western European (Windows) windows-1253 1253 iso-8859-7 windows-1253 windows-1253 Greek (Windows) windows-1254 1254 iso-8859-9 windows-1254 windows-1254 Turkish (Windows) csISO2022JP 50221 iso-2022-jp iso-2022-jp csISO2022JP Japanese (JIS-Allow 1 byte Kana) iso-2022-kr 50225 iso-2022-kr euc-kr iso-2022-kr Korean (ISO)