Last post Aug 09, 2007 06:47 AM by Svante
Aug 08, 2007 12:13 PM|sanjay.btech|LINK
Aug 08, 2007 01:18 PM|DarrellNorton|LINK
Aug 09, 2007 12:14 AM|Bravo9|LINK
Notepad can open and read Unicode. It can also save ASCII as Unicode and vice versa.
Aug 09, 2007 06:47 AM|Svante|LINK
As mentioned, Notepad itself can work with text in several character sets, notably ANSI and Unicode, and with various character encoding schemes for the Unicode characters set (UTF-16BE, UTF-16 and UTF-8).
The ASCII character set and encoding is a subset of the ANSI character set and encoding and the UTF-8 character set encoding scheme.
(A character set is the set of characters that can be represented. A character encoding is the process of assigning numbers to these characters. A character encoding scheme is how these numbers are serialized into a byte stream.)
So... If you from Notepad save characters that are not part of the ANSI character set as an ANSI file, these will not be properly represented in the file, if I recall correctly they are either removed, or replaced by placeholders.
The .NET FCL StreamReader on the other hand, will actually be a little smart about reading the contents of a file, using what's called a Byte Order Mark to try to guess if it's a Unicode character set encoded file, or an ANSI encoding. So normally, this
works just fine. You can also specify just what encoding you'd like the StreamReader to assume when reading the file, if the guesswork does not work out.
So, with this background, can you give some more details about just what is not working? I.e. a sequence of events and the result versus the expected result, this is not clear from your post.