Encoding.BigEndianUnicode Property
Gets an encoding for the Unicode format in the big-endian byte order.
[Visual Basic] Public Shared ReadOnly Property BigEndianUnicode As Encoding [C#] public static Encoding BigEndianUnicode {get;} [C++] public: __property static Encoding* get_BigEndianUnicode(); [JScript] public static function get BigEndianUnicode() : Encoding;
Property Value
An encoding for the Unicode format in the big-endian byte order.
Remarks
Unicode characters can be stored in two different byte orders: big-endian and little-endian. On little-endian platforms such as Intel machines, it is generally more efficient to store Unicode characters in little-endian order. However, many other platforms can store Unicode characters in big-endian order.
Unicode files can be distinguished by the presence of the byte order mark (U+FEFF), which is represented as hexadecimal 0xFE 0xFF on big-endian platforms and hexadecimal 0xFF 0xFE on little-endian platforms.
Example
[Visual Basic] Imports System Imports System.IO Namespace BigEndianExample Public Class Class1 Public Overloads Shared Sub Main() ' Read a text file saved with Big Endian Unicode encoding. Dim encoding As System.Text.Encoding = System.Text.Encoding.BigEndianUnicode Dim reader As New StreamReader("TextFile.txt", encoding) Dim line As String = reader.ReadLine() While Not (line Is Nothing) Console.WriteLine(line) line = reader.ReadLine() End While End Sub End Class End Namespace [C#] using System; using System.IO; namespace BigEndianExample { public class Class1 { public static void Main(string[] args) { // Read a text file saved with Big Endian Unicode encoding. System.Text.Encoding encoding = System.Text.Encoding.BigEndianUnicode; StreamReader reader = new StreamReader("TextFile.txt", encoding); string line = reader.ReadLine(); while (line != null) { Console.WriteLine(line); line = reader.ReadLine(); } } } } [C++] #using <mscorlib.dll> using namespace System; using namespace System::IO; int main() { // Read a text file saved with Big Endian Unicode encoding. System::Text::Encoding * encoding = System::Text::Encoding::BigEndianUnicode; StreamReader* reader = new StreamReader(S"TextFile.txt", encoding); String* line = reader -> ReadLine(); while (line != 0) { Console::WriteLine(line); line = reader -> ReadLine(); } }
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard