Search code examples
htmlsearchcharacter-encodingmeta-tags

Can I use HTML character entities in meta tags?


I have a web site in two languages - English and Chinese. In the English homepage, which uses UTF-8 charset, I have, e.g.:

<meta name="description" content="Available in English and Chinese">

That appears in search results. I would like to change it to:

<meta name="description" content="Available in English and &#20013;&#25991;">

...where &#20013;&#25991; is the ISO entity for "Chinese". Would that be rendered as "中文" in the search results? I can't paste "中文" directly into the HTML file in Textpad* (pastes as ??).


* Update Was using Textpad 7. Now have Textpad 8, which "operates internally in Unicode UTF-16 encoding" (https://www.textpad.com/support/relnotes.html#v802), and allows me to paste "中文" into the meta tags.


Solution

  • Can I use HTML character entities in meta tags?

    Yes. Places where you can't use entities in HTML are few and far between (in the bodies of script and style elements are the only ones that spring to mind).

    Would that be rendered as "中文" in the search results?

    Assuming:

    • The search engine didn't have a bug related to that
    • The search engine's algorithm selected the description as something to display at all

    Yes