Hi,
I generate and temporary saves a text file to disk. Later I upload this file
to Microsoft MapPoint (not so important).
The file needs to be in UTF-8 encoding and I explicitly use the
"Encoding.UTF8" in the constructor like this:
StreamWriter writer = new StreamWriter(file, Encoding.UTF8);
When I do this the StreamWriter inserts an UTF-8 preamble "" into the
beginning of the file.
// http://www.chilkatsoft.com/faq/Utf8Preamble.html
MapPoint throws an Exception for this UTF-8 preamble and aborts the parsing
of the file.
The annoying thing is that if I don´t explicitly state the Encoding in the
constructor the documentation for StreamWriter.Encoding property says:
"The Encoding specified in the constructor for the current instance, or
UTF8Encoding if an encoding was not specified."
But! If I don´t specify the encoding I end up with text that is not UTF-8
(without the preamble..).
Without the Encoding in the constructor: "Fältöverstens Teleshop"
With the Encoding in the constructor: "Fältöverstens Teleshop"
So my question is how can I get ride of this preamble? Because if I get ride
of that everything should work...
Regards
/Oscar