Closing HTML tags insert "phantom" space in Chinese text

63 Views Asked by At

(Note: I can't provide an image or a sample file; uploads and imgur are blocked from this location.) Images added.

I recently received a Word document translation into Chinese (traditional) of one of my web pages. The translator has the translation up in HTML at https://home.gamer.com.tw/artwork.php?sn=5854378. The English original is at https://www.freelancetraveller.com/features/rules/finprofile.html. However, inspecting the HTML of the translation reveals a lot of deprecated and obsolete HTML, such as the <font> tag. Of specific interest here is the second table (with the numbers) and the third paragraph following it.

The data in the second column, second row of that table shows a bold number, a slash, and an italicised underlined number. My HTML in the translated page that I intend to post at Freelance Traveller (it has not been posted because I want to solve this problem) is (within the td)

<strong>Cr20000</strong>/<em><u>Cr20800</u></em>

This is causing an undesired space after the closing </strong> tag:

The appearance of the data in the table

Three paragraphs below, I have a similar situation: there are four Chinese characters within parentheses near the end of that paragraph; the parens are not colored, but the characters are on a yellow background.

(<span style="background-color: yellow;">&#34722;&20809;&24213;&33394;</span>)

causes there to be an undesired space after the four Chinese characters (regardless of whether I insert them as HTML entities as here, or the actual Unicode/UTF-8 characters):

The appearance of colored text in parens

Obviously, there is no space in the HTML, as above. It is only the closing tags that cause this; there is no similar space between the leading parenthesis and the first of the four Chinese characters.

It should be noted that this also causes it to be impossible to right-align the numbers in the table in the Chinese.

Advice?

1

There are 1 best solutions below

0
On BEST ANSWER

This appears to have been an artifact, not a real problem. When I uploaded the files to my provider’s server as a test (they’re not linked to be publicly visible yet), the “phantom spaces” do not appear - they only appear (on both Chromium [Edge and Chrome] and Gecko browsers) when the file is loaded from the local disk (browser’s file:/// protocol). The reason for the artifact isn’t known, but knowing that it’s an artifact and not a real issue is acceptable if not ideal.

The environment is Windows 11. Programs used for editing the HTML were Notepad, Notepad++, VIM, and BlueGriffon. The artifact appears as well in BlueGriffon’s rendering/WYSAWYG view; this is what “raised the alarm” initially.

(I should note that this is a recent occurrence, only since starting to have Chinese in my pages – before that, there was no problem.)