Documentation about the XML entity escape used by KDialog

Previously posted at KDE forum but no responses.

The new forum has a limitation that new users cannot put multiple links and images in the post, so I have to post the URLs as code. Sorry for the inconvenience.


Hello. I’m maintaining a cross-platform dialog library, and it uses KDialog under the hood. I encountered a problem about the markup language.

When it was two or thee years ago (in Ubuntu 20.04), kdialog (version 19.12) supports some XML entity escape like HTML, such as   (non-breaking space), & (&), " ("), ' ('), and so on.

Image: https://user-images.githubusercontent.com/2662758/241346136-1255342c-f4da-4253-9eba-6e0c7321045b.png

However, it is found that in recent versions of KDialog, some entity are not supported anymore, while some still work.

Image: https://user-images.githubusercontent.com/2662758/243207967-632530ca-eb48-4948-937f-211f28aefb04.png

Image: https://user-images.githubusercontent.com/2662758/241476127-9e31d929-217b-43fc-9739-132e2f25309d.png

I cannot find any KDE documentation that describes this change. When I tried figuring it out from the source code, I found that the code related to displaying text in the dialogs have never changed for years. Git blame shows this:

  • The text preprocessing function in KDialog - https://github.com/KDE/kdialog/blame/master/src/utils.cpp#L46
  • KDialog sends the text to KMessageBox under the hood - https://github.com/KDE/kdialog/blame/master/src/kdialog.cpp#L515
  • KMessageBox sends the text to QLabel to display them - https://github.com/KDE/kwidgetsaddons/blame/master/src/kmessagebox.cpp#L219

Could anyone tell me which version did this change happen, and what has been changed exactly?

See also: native-dialog-rs/native-dialog-rs#41

We’re switching to Qt 6, so maybe that’s where the change came from? We mostly use Qt for HTML/Rich Text stuff.

FWIW, I can’t reproduce the bug if I do kdialog --msgbox '<html><body>Non&nbsp;breaking&nbsp;spaces</body></html>'

I’m not sure… but the screenshot is of Arch Linux, and the kdialog it provides is still depending on Qt 5.

image


This information is useful! Thank you anyway.

Same can’t reproduce with both qt5 and qt6