[ACCEPTED]-Euro sign in HTML-euro

Accepted answer
Score: 38

Which one would you use in HTML?

None of 15 them. Use an appropriate encoding (i.e.: UTF-8 14 or another Unicode transform) and use the 13 charcter directly. Do not use HTML entities 12 if at all avoidable, since they’ve got no 11 advantage over use of a proper encoding.

Also, this 10 is wrong:

It's a pity that there is no standard 9 way to display the sign.

There is, and it’s 8 the way I’ve described. Literally every browser, down 7 to and including MSIE 5 will display Unicode 6 characters correctly if the chosen fond 5 supports the glyph.

The only valid reason to not 4 use Unicode characters and instead fall 3 back to entities might be projects that 2 use legacy software which doesn’t support 1 Unicode well. But that should never happen, right?

Score: 9

According to Google Doctype € is supported in all browsers. But 3 maybe not all fonts.

edit I also agree with Konrad 2 Rudolph, use the character directly if you 1 can.

Score: 2

From Google's HTML/CSS styleguide:

Do not 8 use entity references. There is no need 7 to use entity references like —, ”, or 6 ☺, assuming the same encoding (UTF-8) is 5 used for files and editors as well as among 4 teams.

The only exceptions apply to characters 3 with special meaning in HTML (like < and 2 &) as well as control or “invisible” characters 1 (like no-break spaces).

<!-- Not recommended -->
The currency symbol for the Euro is &ldquo;&eur;&rdquo;.

<!-- Recommended -->
The currency symbol for the Euro is “€”.
Score: 1

You should really just test it and specify 5 those browsers that support it as minimum 4 requirements. This eases your workload considerably 3 since it makes the user responsible :-) Or, alternatively, use 2 the word "euro" or the "EUR" curruncy designator 1 (like USD, AUD, JPY and so on).

Score: 0

I use &#128; as you can see here : € it works 1 in Firefox, Chrome and IE at least.

Score: 0

The accepted answer is actually awful,at 10 least as of today. Best choice is to use &euro;

&#128; is not Unicode, btw, even 9 though it works. It's ANSI. JavaScript String.fromCodePoint(128) will 8 give you a control character you won't even 7 be able to see. Stay away from that.

If you're 6 going to use plain UTF-8 text for symbols 5 you might end up having mistakes after changing 4 db properties, or if you're just typing 3 it into file, once you accidentally copy 2 it into an ANSI-coded, or some a file with 1 some other encoding. Been there.

More Related questions