Search code examples
htmlvalidationw3cfont-awesome

Fontawesome usage displeases W3C Validator


I am using the WOFF version of Fontawesome to embed icon font characters in my markup. This works well - fontawesome is quite simply neat. The only issue that arises is when I feed markup containing fontawesome chars to the W3C validator which expresses its displeasure with something along the lines of

Document uses the Unicode Private Use Area(s), which should not be used in publicly exchanged documents.

The offending character in this case is the "pencil" icon in Fontawesome, uF040, &#61504 which is being used in a data attribute and also in displayed text.

<a data-role="button" title='Register' class='ui-body-c jr_rbt jr_tac' data-theme="b" data-mini    
= "true" data-inline="true" data-bcapt='[font=fontawesome|400][/font] Join 
[font=fontawesome|400]&#61504;[/font] Signup    [font=fontawesome|400]&#61504;[/font] 
Register'>
<span style='font-family:"fontawesome";font-weight:400;'></span> Join
</a>

I guess I could just ignore this since it has no untoward consequences. However, it would be nice to keep my pie and eat it too. Is there any way to use PUA chars in a public HTML document and still keep W3C happy?

For good measure I tried using the entity values but it made no difference - rationally, there is no reason why it should. I should mention that I am validating by direct text input.


Solution

  • Maintainer of the W3C HTML Checker here.

    I guess I could just ignore this since it has no untoward consequences.

    Yeah. It's just a warning, not an error.

    However, it would be nice to keep my pie and eat it too. Is there any way to use PUA chars in a public HTML document and still keep W3C happy?

    There’s not such a way currently. I could consider dropping this check but we’ve had it a long time: https://hsivonen.fi/charmod-checking/ and https://www.w3.org/TR/charmod/#C073

    As with other warnings that’ve been added, the spirit behind this is to try to alert developers to something they might be doing by mistake or to inform them about something that might cause their documents to not work they way they might expect in different browsers/environments.

    But when you're doing something intentionally and are aware of the risks, it's fine to ignore the warnings (or even the errors) that the checker emits. It's not there to try to punish you. It's just sort of a linter but with documented/standardized linting rules.

    Anyway, the Web UI at https://validator.w3.org/nu/ it has a Message filtering button that lets you permanently ignore/suppress any particular error/warning messages you don't want to see.