-
May 6th, 2021, 03:21 #1
- Join Date
- Nov 2018
- Posts
- 389
Extra spaces added around formatted text when there are adjacent characters
Something I've noticed with formatted text in Story entries (and other records) is that when there is formatted text in quotes that after reloading the campaign there will be extra spaces added in. This is most apparent with text that is wrapped in quotes, but it appears to happen with formatted text with any adjacent non-space character.
For example, in Capture.JPG, you can see spaces between the single quote character and the word "bold" - these spaces were not present when the story was created but appeared after reloading the campaign.
db.xml when above story was created:
Code:<id-00001> <locked type="number">1</locked> <name type="string">Story</name> <text type="formattedtext"> <p> <b>Bold</b> text</p> <p>Quoted '<b>bold</b>' text with non-bold quotes</p> <p>Quoted <b>'bold'</b> text with bold quotes</p> <p /> <p> <i>Italic</i> text</p> <p>Quoted '<i>italic</i>' text with non-italic quotes</p> <p>Quoted <i>'italic'</i> text with italic quotes</p> <p /> <p> <u>Underline</u> text</p> <p>Quoted '<u>underline</u>' text</p> <p>Quoted <u>'underline'</u> text with underlined quotes</p> </text> </id-00001>
Code:<id-00001> <locked type="number">1</locked> <name type="string">Story</name> <text type="formattedtext"> <p> <b>Bold </b>text</p> <!-- note this line has moved the space into the format tag --> <p>Quoted ' <b>bold </b>' text with non-bold quotes</p> <!-- note this line has added spaces --> <p>Quoted <b>'bold' </b>text with bold quotes</p> <!-- note this line has moved the space into the format tag --> <p /> <p> <i>Italic </i>text</p> <p>Quoted ' <i>italic </i>' text with non-italic quotes</p> <p>Quoted <i>'italic' </i>text with italic quotes</p> <p /> <p> <u>Underline </u>text</p> <p>Quoted ' <u>underline </u>' text</p> <p>Quoted <u>'underline' </u>text with underlined quotes</p> </text> </id-00001>
- Create a new story entry
- Add text to the story entry and format some text that has adjacent non-space characters. Example: Capture2-Before.JPG
- In this example one line contains "someboldtext" without spaces around the word bold
- Save the campaign and examine db.xml, which looks as expected:
Code:<id-00002> <locked type="number">1</locked> <name type="string">Story 2</name> <text type="formattedtext"> <p>Here is some<b>bold</b>text with adjacent characters</p> <p>Here is some <b>bold</b> text with adjacent spaces</p> <p /> <p>Here is some<i>italic</i>text with adjacent characters</p> <p>Here is some <i>italic</i> text with adjacent spaces</p> <p /> <p>Here is some<i>underlined</i>text with adjacent characters</p> <p>Here is some <i>underlined</i> text with adjacent spaces</p> </text> </id-00002>
- Reload the campaign and examine the story entry. Now, there are spaces around the formatted words that didn't have spaces around them before: Capture2-After.JPG
- Save the campaign and inspect db.xml, which has been updated to include extra spaces:
Code:<id-00002> <locked type="number">1</locked> <name type="string">Story 2</name> <text type="formattedtext"> <p>Here is some <b>bold </b>text with adjacent characters</p> <p>Here is some <b>bold </b>text with adjacent spaces</p> <p /> <p>Here is some <i>italic </i>text with adjacent characters</p> <p>Here is some <i>italic </i>text with adjacent spaces</p> <p /> <p>Here is some <i>underlined </i>text with adjacent characters</p> <p>Here is some <i>underlined </i>text with adjacent spaces</p> </text> </id-00002>
No extensions
FGU v4.0.10 2021-02-04
5E ruleset v2021-04-27
Windows 10
-
May 7th, 2021, 00:16 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,561
This is an artifact of the way that formatted text values are stored as straight XML tags; and specifically the way that FG has stored this data for years (due to backward compatibility).
Unfortunately, it cannot be changed without breaking existing content. I tried a couple times early in FGU development. We eventually have plans to look into alternate encoding for formatted text data; but not until FGC is retired.
Regards,
JPG
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks