Bug 159522 - Extension in Basic macro script: some characters inside the script would cause problem because script is inside an XML file
Summary: Extension in Basic macro script: some characters inside the script would caus...
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.6.4.1 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-02 12:30 UTC by Megidd
Modified: 2024-02-02 12:47 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
Two errors while clicking on the extension button on the toolbar. (470.88 KB, image/png)
2024-02-02 12:30 UTC, Megidd
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Megidd 2024-02-02 12:30:12 UTC
Created attachment 192344 [details]
Two errors while clicking on the extension button on the toolbar.

I'm going to refer to a repository that is mentioned in the LibreOffice documentation and help pages. Consider this code inside the LibreOffice Calc extension:

https://github.com/luane-aquino/helloworld-libreoffice-extension/blob/a3f4927b173f41153ddc054ec6ec3a5712b9bafc/HelloWorldLibrary/Module1.xba#L6

The code is in StarBasic macro programming language. It's inside an XML file named `Module1.xba`.

Any use of some character combinations would cause errors while running the extension. Some troublemaker character sequences are `<>`, `<=`, and `<=>`. For example, this code line would cause extension launch errors:

```
Print " <=> "
```

Or this one:

```
If 1 <> 2 Then
    Print "Reached here?"
End If
```

The attachment shows two errors thrown while clicking on the extension button on the toolbar.

Is it a bug? There shouldn't be some ways of including the StarBasic macro script inside the XML without worrying about some text characters interfering with the XML format and causing launch errors. Maybe I'm missing something.
Comment 1 Megidd 2024-02-02 12:36:00 UTC
There should be some ways of including the StarBasic macro script inside the XML without worrying about some text characters interfering with the XML format and causing launch errors. Right?
Comment 2 Mike Kaganski 2024-02-02 12:43:15 UTC
That is XML. Any text there needs follow the respective rules. < and > are &lt; and &gt; entities, which could be checked by creating some Basic script locally in LibreOffice Basic IDE, and inspecting the resulting files in the user profile.

The link that you provided also shows how to encode double quote character using &quot; entity.

See: https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
Comment 3 Megidd 2024-02-02 12:47:31 UTC
(In reply to Mike Kaganski from comment #2)
> That is XML. Any text there needs follow the respective rules. < and > are
> &lt; and &gt; entities, which could be checked by creating some Basic script
> locally in LibreOffice Basic IDE, and inspecting the resulting files in the
> user profile.
> 
> The link that you provided also shows how to encode double quote character
> using &quot; entity.
> 
> See:
> https://en.wikipedia.org/wiki/
> List_of_XML_and_HTML_character_entity_references

Is there a more convenient way? By any chance.