Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternative to entering entity references in source code

Tags:

html

Google's HTML/CSS Style Guide advises against using entity references:

Do not use entity references.

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

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

I'm not sure I understand what it is that they are proposing. The only thing I can think of is that they are saying that you should be using your text editor's insert character command (e.g., in Atom, Ctrl-Shift-U, or in Emacs, C-x 8) to enter Unicode characters rather than typing in the literal entity references. Is that it?

like image 724
yroc Avatar asked Oct 21 '25 03:10

yroc


1 Answers

The only thing I can think of is that they are saying that you should be using your text editor's insert character command […] rather than typing in the literal entity references. Is that it?

Yes, that's precisely what they're saying.

You don't write &#65; to insert the letter A, after all! There's no more reason to write &auml; for ä, or &hearts; for , when those characters can be represented directly in the HTML file.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!