The feedback I received was as follows after my symbol was indeed like the above in a XML file.
"The euro symbol in this text is not encoded correctly and needs to be in UTF-8"
What could be meant by that
– StevieBMay 31 '10 at 13:14
1
You need to make sure that the (unspecified) software you are using is saving the file in UTF-8 format and nothing is converting it to a different format along the way.
– QuentinMay 31 '10 at 13:17
In iso-8859-15, the € symbol is represented by `0xA4`, replacing a different character from iso-8859-1; in windows-1252, it's `0x80`. So the various single-byte encodings vary in their placement of this symbol - UTF-8 is simply safer.
– Tim PietzckerMay 31 '10 at 13:18
Hey I am creating a XML in a project in Visual Studio using XmlTextWriter. I just noticed I have the following line of code
Encoding utf8 = new UTF8Encoding(false);
Should this be set to true ?
– StevieBMay 31 '10 at 13:21
Maybe I will make more sense like this to.
Ok at the moment my euro symbol is displayed as € in my XML. After I somehow get UTF-8 encoding working how do it look like after ?
– StevieBMay 31 '10 at 13:24
Hey bobince.
Thanks for your reply. But my XML Files are created dynamically ever 15 mins or so I need to do this "UTF-8 encoding of euro symbols" somehow dynamically. Can you suggest a way i can do this via my script ?
I dont understand how € differs from € in UTF-8..
– StevieBMay 31 '10 at 13:40
@StevieB: no, `new UTF8Encoding(false)` is fine. `true` would add a UTF-8-encoded faux-BOM, which in general you don't want. If you are talking about writing `€` in an XML file, just write `€` in the file in a text editor and use ‘Save as’ to save it in the UTF-8 encoding. If you're editing in Visual Studio, I believe the encoding is in File->Advanced Save Options. It totally sucks that Windows tools still default to some useless system default codepage instead of UTF-8.
– bobinceMay 31 '10 at 13:40
1
You should understand what encodings are. The canonical link at this point would be [Spolsky's](http://www.joelonsoftware.com/articles/Unicode.html). How are you creating these files? Where are you writing a `€`? Does it come from code? What does the code look like?
– bobinceMay 31 '10 at 13:43
The files are created from a .NET script.
Im writing the € in out of the elements of the XML File.
The value € is pulled from the database, which was entered in the first play via CMS.
Code looks i.e sample something like this
XMLwriter.WriteElementString("Prim_Status", reader_image["Prim_Status"].ToString());
– StevieBMay 31 '10 at 13:46
You could just use unicode escape sequence in your strings (\u20AC for euro). In example: Console.WriteLine("I need \u20AC") would output I need €
– IvanJun 01 '10 at 22:25