<p>I did a lot of PHP programming in the last years and one thing that keeps annoying me is the weak support for Unicode and multibyte strings (to be sure, natively there is none). For example, &quot;htmlentities&quot; seems to be a much used function in the PHP world and I found it to be absolutely annoying when you've put an effort into keeping every string localizable, only store UTF-8 in your database, only deliver UTF-8 webpages etc. Suddenly, somewhere between your database and the browser there's this hopelessly naive function pretending every byte is a character and messes everything up.</p>
<p>I would just <i>love</i> to just dump this kind of functions, they seem totally superfluous. <b>Is it still necessary these days to write '&amp;auml;' instead of 'ä'?</b> At least my Firefox seems perfectly happy to display even the strangest Asian glyphs as long as they're served in a proper encoding.</p>
<p><b>Update:</b> To be more precise: Are named entities necessary for <i>anything else than displaying HTML tags</i> (as in &quot;&amp;lt;&quot; for &quot;&lt;&quot;)</p>
<h3>Update 2:</h3>
<p>@Konrad: Are you saying that, no, named entities are not needed?</p>
<p>@Ross: But wouldn't it be better to sanitize user input when it's entered, to keep my output logic free from such issues? (assuming of course, that reliable sanitizing on input is possible - but then, if it isn't, can it be on output?)</p>

[{'answer_id': 25135, 'author': 'Teifion', 'author_id': 1384652, 'author_profile': 'https://Stackoverflow.com/users/1384652', 'pm_score': 0, 'selected': False, 'text': "<p>Safari seems to have issues with some glyphs but not others, it may not be <strong>needed</strong> but it's probably best to do so, of course, this is my opinion and not backed up by anything but my own observations.</p>\n"}, {'answer_id': 25144, 'author': 'Konrad Rudolph', 'author_id': 1968, 'author_profile': 'https://Stackoverflow.com/users/1968', 'pm_score': 2, 'selected': False, 'text': "<p>If using XHTML, it's actually recommended not to use named entities ([citation needed]). Some browsers (Firefox …), when parsing this as XML (which they normally don't), don't read the DTD files and thus are unable to handle the entities.</p>\n\n<p>As it's best practice anyway to use UTF-8 as encoding if there are no compelling reasons to do otherwise, this only means that the creator of the documents needs a decent editor that can not only handle the documents but also provides a good way of entering the divers glyphs. OS X doesn't really have this problem because most needed glyphs can be reached via “alt” keys but Windows doesn't have this feature.</p>\n\n<hr/>\n\n<blockquote>\n  <p>@Konrad: Are you saying that, no, named entities are not needed?</p>\n</blockquote>\n\n<p>Precisely. Unless, of course, there are silly restrictions, e.g. legacy database drivers that choke on UTF-8 etc.</p>\n"}, {'answer_id': 25173, 'author': 'Sören Kuklau', 'author_id': 1600, 'author_profile': 'https://Stackoverflow.com/users/1600', 'pm_score': 4, 'selected': True, 'text': '<p>Named entities in "real" XHTML (i.e. with <code>application/xhtml+xml</code>, rather than the more frequently-used <code>text/html</code> compatibility mode) are discouraged. Aside from the five defined in XML itself (<code>&amp;lt;</code>, <code>&amp;gt;</code>, <code>&amp;amp;</code>, <code>&amp;quot;</code>, <code>&amp;apos;</code>), they\'d all have to be defined in the DTD of the particular DocType you\'re using. That means your browser has to explicitly support that DocType, which is far from a given. Numbered entities, on the other hand, obviously only require a lookup table to get the right Unicode character.</p>\n\n<p>As for whether you need entities at all these days: you can pretty much expect any modern browser to support UTF-8. Therefore, as long as you can guarantee that the database, the markup and the web server all agree to serve that, ditch the entities.</p>\n'}]
['https://Stackoverflow.com/questions/25132', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2077/']