Big Endian Unicode Bytes
using System;
using System.Text;
public class MainClass
{
static void Main() {
string str = "abc!";
Encoding unicode = Encoding.Unicode;
Encoding beUnicode = Encoding.BigEndianUnicode;
byte[] unicodeBytes = unicode.GetBytes(str);
byte[] beUnicodeBytes = Encoding.Convert( unicode,
beUnicode,
unicodeBytes);
Console.WriteLine( "Big Endian Unicode Bytes:" );
StringBuilder sb = new StringBuilder();
foreach( byte b in beUnicodeBytes ) {
sb.Append( b ).Append(" : ");
}
Console.WriteLine( "{0}\n", sb.ToString() );
}
}
Output Big Endian Unicode Bytes:
0 : 97 : 0 : 98 : 0 : 99 : 0 : 33 :
|
HTML code for linking to this page:
Related in same category :
-
-
-
|