DOCX: empty space
Virtual Research Environment / On-line Bibliography Manager
Brought to you by:
sirfragalot
With the following example HTML code from tinyMCE:
<sup>Blah</sup> <sub>Blah</sub>
there is a space between the closing sup tag and the starting sub tag. In DOCX, this should be converted to:
<w:r><w:t xml:space="preserve"> </w:t></w:r>
in libs/docx/format/TEXT::text().
However, in attempting to write the space the DOCX code above is never written and the resulting document crasheds in Word.
The way around it, to create a document Word can open, is to detect the space then not write anything (but this, of course, means the space is not written).
Rather puzzling . . .
Mark
And if you try to compose this directly in Word, what code is generated?
What I've noted above:
<w:r><w:t xml:space="preserve"> </w:t></w:r>As far as I can tell, the code I generate is identical. It may be that there is some other code in another .xml file that needs to be in place and that I have overlooked.
Mark
And this space character is indeed ASCII 32 in both cases?
I’m beginning to suspect that the problem might lie elsewhere because, if I test for only spaces in the input (libs/docx/format/TEXT::text()), detect it, then change the input to normal text characters, I still get the problem.
Last edit: Stéphane Aulery 2024-12-09
Yes, probably
I verified that this is not a side effect of
\UTF8\mb_trim()that would modify$inputby reference. One less track.