Using Unicode Encoding
using System; using System.IO; using System.Globalization; using System.Text; public class Encoding_UnicodeToCP { public static void Main() { string str = "test"; int codePage = 1235; Encoding targetEncoding; byte[] encodedChars; targetEncoding = Encoding.GetEncoding(codePage); encodedChars = targetEncoding.GetBytes(str); for (int i = 0; i < encodedChars.Length; i++) Console.WriteLine("Byte {0}: {1}", i, encodedChars[i]); } }