Currently, <span> tags are not on the whitelist of allowed HTML tags. The lang= attribute also is not permitted anywhere. In some contexts, this causes a problem with characters that are Han-unified. If you know what Han unification is and why the HTML lang= attribute is necessary for text that mixes different glyph forms for Han-unified graphemes, skip to the bottom. If not, keep reading.

Here's a rundown of the issue: many characters in Chinese (traditional and simplified), Japanese, Korean, and Vietnamese stem from common ancestral forms, but have since diverged to various degrees. Those that have diverged in a major way have different Unicode codepoints. For example, traditional Chinese 爲 is the "ancestral form" of Japanese 為 and simplified Chinese 为. Someone on the Unicode committee decided that these characters are different enough to have different codepoints (U+7232, U+4E3A, and U+70BA respectively).

However, some other characters are "unified" such that there is only a single codepoint for a given family of related characters, despite them having subtle differences across CJKV. See this table on Wikipedia for examples. The key thing to know is this: the way to tell the browser which glyph variant to display for a given codepoint is to wrap the glyph in a tag that uses the lang= attribute.

Currently, on Japanese.SE, we have custom javascript that automatically wraps all our Japanese text in <span xml:lang="ja" lang="ja"> so that all our text renders using the Japanese glyph variants (some browsers will default to the Chinese glyphs if not instructed otherwise, which makes text look ugly). This works for us most of the time.

However, it's not good enough when we need to include Chinese text in our posts on Japanese.SE (as we sometimes need to do, just as posters on English.SE sometimes need to post Latin text) - the Chinese text also gets displayed using the Japanese glyphs, making the Chinese text look ugly.

And it breaks down spectacularly when we have a post that is entirely about subtle differences between Chinese and Japanese glyphs, like this one: How many Jōyō Kanji are identical to simplified Hanzi?. Here's the problem: consider the following image.

The symbol on the left is supposed to be simplified Chinese, and the symbol on the right inside parentheses is supposed to be Japanese. They're supposed to look subtly different, but they don't - they're pixel-identical because they're both using the Japanese glyph for U+9686. Instead, here's what we want to happen: if we use the following HTML (just in its own file on my local machine):

<span lang="zh">&#x9686;</span>(<span lang="ja">&#x9686;</span>)

We instead get:

Notice the extra line I've pointed to in the simplified Chinese glyph on the left. The fact that these two glyphs are subtly different is the entire point of the post I linked to above, but there's currently no way to represent this on Japanese.SE - we either have to link to an external website/PDF or screenshot the website/PDF and upload the screenshot to stack.imgur. Both of these are less-than-ideal options.

All said and done: I would like to request that the lang= attribute be whitelisted to make it possible to display Chinese and Japanese variants alongside one another, and that we also whitelist <span> so that we have a dummy element to which to attach the attribute. None of the existing whitelisted tags are really suitable, since they all have some semantic value that we don't really want.

I don't foresee any issues arising from this; you can't really do anything with a <span> tag whose only attribute is lang= besides specify which CJKV variant of a unified Han grapheme you want to display, as far as I know.

Another affected post on Japanese.SE: The component 曷 and the kanjis 褐, 喝, 謁, 渇

  • modelviewculture.com/pieces/…
    – random
    Commented Mar 21, 2015 at 17:26
  • 2
    I support this proposal, but I'd suggest that, for situations where you're discussing glyphs as glyphs, and where the exact shape of a character really matters (like the example you linked to), you probably should use images anyway, just to be sure that you really get the intended rendering on all browser / OS / font set combinations. Commented Mar 21, 2015 at 20:49
  • 3
    I strongly support this proposal. As much as I appreciate han unification, it's essential that any website, especially stack exchange and even more so Japanese Stack Exchange, can support display of other character forms so that we can properly use Japanese script. This change is, of all the meta posts, probably the most important. This isn't about classification on stack exchange or whether a tag is useful or not, this is about being incapable of properly writing and representing Japanese and Chinese on a website dedicated to answering questions about Japanese and Chinese.
    – sqrtbottle
    Commented Dec 7, 2015 at 17:13
  • @IlmariKaronen Yes, they are glyphs due to Unicode's technical restrictions (maybe until Adobe make it through with their standard variants), but don't forget that they are words at the same time. Consider what would happen if you must make pictures each time to show the difference between color and colour, weiß and weiss, or ótimo and óptimo? Commented Jan 13, 2016 at 6:43


You must log in to answer this question.

Browse other questions tagged .