0

Using h:outputText I want to display a left arrow ← using ←. But it just doesn't render on the page (not even in the inspect element output). What did I do wrong?

<h:outputText value="Overtime (Remaining &larr; New)" />

enter image description here

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Selbi
  • 813
  • 7
  • 23
  • What **does** it render? If there is nothing, your problem is weird. Of there is something, the answer might be correct. – Kukeltje Dec 13 '18 at 18:11
  • It renders the text I posted in the screenshot. The normal contents of the string are there, but the arrow gets simply skipped. As I've said, it doesn't appear in inspect element. – Selbi Dec 13 '18 at 22:47
  • Exactly the same text as on the screenshot: "Overtime (Remaining New)" – Selbi Dec 13 '18 at 23:08
  • Inspect element is different than the source. it is interpreted by the browser. The real source is not! – Kukeltje Dec 13 '18 at 23:08
  • I've posted the source in my question already. Are we talking about the same thing? – Selbi Dec 13 '18 at 23:09
  • Visibility is on the client, so I talk about the client html source, not the server-side xhtml source (sorry, that was in a deleted comment) – Kukeltje Dec 13 '18 at 23:18
  • Is it possible due to a font that doesn't contain symbols like this? – Selaron Dec 14 '18 at 07:55

1 Answers1

3

Root problem is, &larr; is not a XML entity. It's a HTML entity.

Facelets is XML based and XML has only 5 predefined entities: &amp;, &quot;, &apos;, &lt;, &gt;. All others you might have seen or heard about are all HTML entities and not supported in XML.

Historically, HTML entities were used to support "special" characters anyway when using inferior character encodings such as ISO-XXX instead of UTF-XXX. But since the introduction and worldwide support of UTF-XXX character encodings, we don't really need these HTML entities anymore.

XML supports UTF-8, so just print right away.

<h:outputText value="Overtime (Remaining ← New)" />

Or even without a whole <h:outputText> as you don't actually need to convert anything here.

Overtime (Remaining ← New)

See also:

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Ohhhhh... I didn't know there was a difference. Unfortunately, I cannot put unicode directly into the source, as our CMS has a history of turning those into mojibake. I've just tested it with <- `<-` and it does the job, even if not as pleasing. Thank you very much! – Selbi Dec 15 '18 at 15:04