Encoding Text für writing a textfile

  • Thread starter Thread starter Martin Fischer
  • Start date Start date
M

Martin Fischer

Hi everybody,

i have a problem with teh StreamWriter Object. I want to force the Stream to
write an ANSI-text. For reading from an filestream i can define the type of
ASCI by setting
System.Text.Encoding.Default.

What about Wrting Textdate ? The result seems to be UTF7 -Charset, but no
real ANSI.

Any hint for me ?

Martin
 
Hi everybody,

i have a problem with teh StreamWriter Object. I want to force the
Stream to
write an ANSI-text. For reading from an filestream i can define the type
of
ASCI by setting
System.Text.Encoding.Default.

What "type of ASCII"? There's only one ASCII. How do you set
System.Text.Encoding.Default, given that it's a read-only property?

As far as the StreamWriter goes, you can specify an encoding via the
constructor when you instantiate the StreamWriter.

Pete
 
Do you mean you want the file written in plain ASCII?

This appears to produce a simple ASCII text file:

FileStream FS = new FileStream("d:\\myfile.txt",FileMode.OpenOrCreate);
StreamWriter SW = new StreamWriter(FS, Encoding.ASCII);
 
Thanks a lot. Thats what i ve been searching for ...

I have been trying to create a StreamWriter-Object without creating a
previos filestram, and in this structure i didnt find a way to specify the
Encodeng ....

Wish you a nice weekend.

Martin
 
Back
Top