UTF-16 character File

Here's how we write the same string with UTF-16:


using System;
using System.IO;
using System.Linq;
using System.Text;
class Program
{
    static void Main()
    {
        using (Stream s = File.Create("text.txt"))
        using (TextWriter w = new StreamWriter(s, Encoding.Unicode))
            w.WriteLine("but-");

        foreach (byte b in File.ReadAllBytes("but.txt")) 
            Console.WriteLine(b);
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.