T
Todd
I am writing a method to do some standard conversions on the text of a
file. However, I am having difficulty getting the StreamReader and
StreamWriter to behave. The input file is a Visual Studio 6.0 C++ .rc
file (I believe it's in ASCII). The input file contains a line with a
copyright character. I am unable to read and write the file without
the file IO routines messing up the copyright character. The code is
similar to the following:
String text = String.Empty;
using (TextReader reader = new StreamReader(file.FullName,
System.Text.Encoding.UTF7))
{
text = reader.ReadToEnd();
}
using (TextWriter writer = new StreamWriter(file.FullName, false,
System.Text.Encoding.UTF7))
{
writer.Write(transformedText);
}
I have tried every combination of encoding for both the reader and the
writer with no luck.
Every encoding except UTF7 fails to retrieve the copyright symbol on
the read. However every encoding I try for the write fails. The worst
is UTF7. The best is UTF8 or ASCII. However, in both cases the file
is unreadable by Visual Studio 6.0.
Any ideas?
Todd Breyman
file. However, I am having difficulty getting the StreamReader and
StreamWriter to behave. The input file is a Visual Studio 6.0 C++ .rc
file (I believe it's in ASCII). The input file contains a line with a
copyright character. I am unable to read and write the file without
the file IO routines messing up the copyright character. The code is
similar to the following:
String text = String.Empty;
using (TextReader reader = new StreamReader(file.FullName,
System.Text.Encoding.UTF7))
{
text = reader.ReadToEnd();
}
using (TextWriter writer = new StreamWriter(file.FullName, false,
System.Text.Encoding.UTF7))
{
writer.Write(transformedText);
}
I have tried every combination of encoding for both the reader and the
writer with no luck.
Every encoding except UTF7 fails to retrieve the copyright symbol on
the read. However every encoding I try for the write fails. The worst
is UTF7. The best is UTF8 or ASCII. However, in both cases the file
is unreadable by Visual Studio 6.0.
Any ideas?
Todd Breyman