How to convert the symbol - "†" to HTML?

I am trying to write the dagger symbol '†' to an HTML page that is being converted to a PDF document, but it displays in PDF as "

I understand that I need to use HTML code for this character, which † .

I did this successfully for "€", but in these cases I wrote the code directly in HTML. In this case, I am reading a character from an XML file. When I check the value of a variable containing a symbol, it displays as '†'.

I should notice that I tried reading the character and code from the XML file as follows:

 <fund id="777" countryid="N0" append="&#8224;" /> 

and

 <fund id="777" countryid="N0" append="†" /> 

but both of them are saved in the variable as a symbol, and when I write them to the page, both are displayed as "â". In addition, I have tried the following:

 string code = "&#8224;"; string symbol = "†"; string htmlEncodedCode = HttpUtility.HtmlEncode(code); string htmlEncodedSymbol = HttpUtility.HtmlEncode(symbol); tc.Text = fund.Name + code + " " + symbol + " " + htmlEncodedCode + " " + htmlEncodedSymbol; 

but only the first work. It appears in the document as:

 FundName† †&#8224; †

Can anyone suggest how I can make this work?

Update:

@James Curran answer below was correct. For clarity, I had to change the XML to:

 <fund id="777" countryid="N0" append="&amp;dagger;" /> 

and in my C #:

 tc.Text = fund.Name + append; 
+4
source share
3 answers

This symbol is commonly known as a "dagger" and is represented in the html entity: &dagger; & dagger;

+5
source

This is an encoding problem. This is probably a Latin image of a dagger in UTF-8. Try converting the dagger from UTF-8 to ISO-8859-1.

+1
source

In the XML file, what you probably want to do is something like the following:

 <fund id="777" countryid="N0" append="&amp;#8224;" /> 

The reason is that the XML file will interpret &amp; as a symbol and, and the rest as a literal. So in your html you get &#8224; and that should do you.

0
source

All Articles