From kde-panel-devel Sun Nov 30 21:14:19 2014 From: "Mark Gaiser" Date: Sun, 30 Nov 2014 21:14:19 +0000 To: kde-panel-devel Subject: Re: Review Request 121296: Escape ampersands in notifications Message-Id: <20141130211419.22787.77832 () probe ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-panel-devel&m=141738207611346 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============2294353759411623797==" --===============2294353759411623797== Content-Type: multipart/alternative; boundary="===============3986961108686964977==" --===============3986961108686964977== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://git.reviewboard.kde.org/r/121296/#review71134 ----------------------------------------------------------- This didn't work? http://qt-project.org/doc/qt-5/qstring.html#toHtmlEscaped - Mark Gaiser On nov 30, 2014, 8:33 p.m., Kai Uwe Broulik wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://git.reviewboard.kde.org/r/121296/ > ----------------------------------------------------------- > > (Updated nov 30, 2014, 8:33 p.m.) > > > Review request for Plasma and Martin Klapetek. > > > Bugs: 341029 > https://bugs.kde.org/show_bug.cgi?id=341029 > > > Repository: plasma-workspace > > > Description > ------- > > Since notifications now enforce StyledText and due to how QtQuick Text (or QTextDocument for that matter) treat HTML entities, it cuts off text whenever there's a alone & somewhere. > > This fancy regexp from [1] keeps &quot; &amp; &lt; &gt; and &apos; while replacing any other with &. This makes the StyledText enforcement safe for 5.1 imho. > > (My impression is that an & triggeres the "look for the semicolon that terminates this entity" which it won't find and then just cut off the text, see QTBUG-33368, in contrast to every webbrowser that just prints these verbatim) > > [1] https://stackoverflow.com/questions/16423089/regex-match-ampersand-but-not-escaped-xml-characters > > > Diffs > ----- > > dataengines/notifications/notificationsengine.cpp 8bc50e7 > > Diff: https://git.reviewboard.kde.org/r/121296/diff/ > > > Testing > ------- > > Deleting "Battery & Brightness" undo notification works as expected and kdialog --passivepopup "test & test & test "test"" works as expected > > > Thanks, > > Kai Uwe Broulik > > --===============3986961108686964977== MIME-Version: 1.0 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: 7bit
This is an automatically generated e-mail. To reply, visit: https://git.reviewboard.kde.org/r/121296/

This didn't work? http://qt-project.org/doc/qt-5/qstring.html#toHtmlEscaped


- Mark Gaiser


On november 30th, 2014, 8:33 p.m. UTC, Kai Uwe Broulik wrote:

Review request for Plasma and Martin Klapetek.
By Kai Uwe Broulik.

Updated nov 30, 2014, 8:33 p.m.

Bugs: 341029
Repository: plasma-workspace

Description

Since notifications now enforce StyledText and due to how QtQuick Text (or QTextDocument for that matter) treat HTML entities, it cuts off text whenever there's a alone & somewhere.

This fancy regexp from [1] keeps &amp;quot; &amp;amp; &amp;lt; &amp;gt; and &amp;apos; while replacing any other with &amp;. This makes the StyledText enforcement safe for 5.1 imho.

(My impression is that an & triggeres the "look for the semicolon that terminates this entity" which it won't find and then just cut off the text, see QTBUG-33368, in contrast to every webbrowser that just prints these verbatim)

[1] https://stackoverflow.com/questions/16423089/regex-match-ampersand-but-not-escaped-xml-characters

Testing

Deleting "Battery & Brightness" undo notification works as expected and kdialog --passivepopup "test & test &amp; test &quot;test&quot;" works as expected

Diffs

  • dataengines/notifications/notificationsengine.cpp (8bc50e7)

View Diff

--===============3986961108686964977==-- --===============2294353759411623797== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel --===============2294353759411623797==--