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">隆</span>(<span lang="ja">隆</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 褐, 喝, 謁, 渇