Hi Arun,
You are not saving and reading the file using the same Encoding.
If you do not specify encoding the StreamWriter/Reader will default to UTF8,
but other applications often default to the code page used by your current
locale, Encoding.Default (ANSI). For instance, Notepad uses ANSI encoding if
not told otherwise.
Check your reading/writing code. If both reading and writing uses UTF8, do
other parts of your program, or other applications, create the file in
question?
--
Happy Coding!
Morten Wennevik [C# MVP]
"ar******@gmail.com" wrote:
Hi,
After writing the £ (pound sterling) symbol to a file using
StreamWriter using the default encoding UTF8, when I retrieve it the
file symbol £ gets changed. But when I use Encoding.Default in the
StreamWriter, I am able to retrieve the symbol without any issue.
Can you tell me why this is so? Microsoft recommend using UTF8 for
encoding, but it does not seem to work in this case.
thanks,
Arun