Wednesday, May 12, 2010

System.Text.ASCIIEncoding.ASCII

Saving a textfile from Vb or C# you think is just text but oh noo.
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 that
isn'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        

MySQL to MariaDB

 Here is a good description how to migrate to MariaDb MySQL to MariaDb Example of how to dump data from MySQL port=3307: mysqldump --user=ro...