Following code:
My.Computer.FileSystem.WriteAllText("c:\MyFileName.txt", txt, False)
Saves a text file, BUT you will have a couple of extra characters ÿþ (0xFF 0xFE) in the beginning of the file thatisn't shown in your favourite text editor .
You can even compare two files in WinMerge and it doesn't report those extra characters.
The extra characters ÿþ is used to tag the file as a Utf-8 file.
To save a clean text file use the following code:
My.Computer.FileSystem.WriteAllText("c:\MyFileName.txt", txt, False, System.Text.ASCIIEncoding.ASCII)
This 'Feature' has made my day two times now, so its time for me to remember it,
System.Text.ASCIIEncoding.ASCII
System.Text.ASCIIEncoding.ASCII
System.Text.ASCIIEncoding.ASCII
System.Text.ASCIIEncoding.ASCII
System.Text.ASCIIEncoding.ASCII
System.Text.ASCIIEncoding.ASCII
Don't forget
System.Text.ASCIIEncoding.ASCII
System.Text.ASCIIEncoding.ASCII
System.Text.ASCIIEncoding.ASCII