generate text file with other codepage or encoding

  • Thread starter Thread starter fabian
  • Start date Start date
F

fabian

Hi,

I've got this code:

Dim fo As File
Dim swriter As StreamWriter

swriter = fo.CreateText("c:\prueba.txt")
swriter.Write("this is a test")
swriter.Close()

I'd like to generate this text file choosing the encoding or codepage that I
want. Is there any class I can use to do it?I've tried with 'Encoding'
class, but I don't know how to use it to generate the file with the encoding
I want.

thanks.
 
fabian said:
I'd like to generate this text file choosing the encoding or codepage that
I
want. Is there any class I can use to do it?I've tried with 'Encoding'
class, but I don't know how to use it to generate the file with the
encoding
I want.

Use 'StreamWriter' only and pass the desired encoding to its constructor
(see documentation for overloaded 'StreamWriter' constructors).
 
sorry Herfried,

could you give me an example?


Herfried K. Wagner said:
Use 'StreamWriter' only and pass the desired encoding to its constructor
(see documentation for overloaded 'StreamWriter' constructors).
 
Back
Top