Re: File.CreateText
- From: Joerg Jooss <news-reply@xxxxxxxxxxxxx>
- Date: Thu, 24 Aug 2006 21:59:59 +0000 (UTC)
Thus wrote Jon,
Hello all,
I'm creating a file with the extension mai and the file contents are
in Japanese (シャーのエア抜き). Now the code works and creates the file, but
when I open it in Wordpad, the japanese text has become
シャーã®ã‚¨ã‚¢æŠœã.
Why is this and can anyone help?
It seems WordPad only recognizes UTF-8 encoded text when the file includes a byte order mark (BOM). File.CreateText() creates UTF-8 encoded files without a BOM.
Therefore, instead of
StreamWriter writer = File.CreateText("file.txt"); use
StreamWriter writer = new StreamWriter("file.txt", false, Encoding.UTF8);
to create your StreamWriter.
Cheers,
--
Joerg Jooss
news-reply@xxxxxxxxxxxxx
.
- Prev by Date: RE: A connection attempt failed problem
- Next by Date: Re: URGENT - Very Puzzled - IIS Authentication
- Previous by thread: Incorrect duplicate ID added to server control, leaving it with 2 IDs
- Next by thread: asp.net 2.0 membership ASPNETDB_TMP.MDF" is on a network path that is not supported for database files
- Index(es):