write special chars to textfile

  • Thread starter Thread starter Snuyt
  • Start date Start date
S

Snuyt

Hello,

I try to export some text to a textfile. But when I use special
characters such as é, à, è, ... I get some weird characters in the
resulting file:

"saisonnières et thématiques." instead of "saisonnières et thématiques."

Here is the code:

Dim line, filename As String
Dim myStreamWriter As StreamWriter
filename="test.txt"
myStreamWriter = File.CreateText(filename)
line="the text which is written to the textfile"
myStreamWriter.WriteLine(line)
myStreamWriter.Flush()

Does anyone knows a solution to this problem

Thanks,

Snuyt
 
* Snuyt said:
I try to export some text to a textfile. But when I use special
characters such as é, à, è, ... I get some weird characters in the
resulting file:


"saisonnières et thématiques." instead of "saisonnières et thématiques."

Here is the code:

Dim line, filename As String
Dim myStreamWriter As StreamWriter

\\\
Dim fs As New FileStream(...)
Dim MyStreamWriter As New StreamWriter(fs, Encoding.<...>)
///

Replace the '<...>' with the encoding you want to use that includes the
characters.
 
Back
Top