D19052: Fix captions with non-BMP characters

Christoph Feck <[email protected]>
Newsgroups gmane.comp.kde.devel.kwin
Message-ID <[email protected]>
cfeck created this revision.
cfeck added a reviewer: KWin.
Herald added a project: KWin.
Herald added a subscriber: kwin.
cfeck requested review of this revision.

REVISION SUMMARY
  KWin replaces any non-printable character with a space. This check does not handle surrogate pairs correctly. Additionally, translators sometimes insert non-printable soft-hyphens into titles, which also cause KWin to display a space instead.
  
  This code adds the missing surrogate handling, and (to fix both issues), also removes non-printable characters instead of replacing them with a space.
  
  Also moved the `changed` test after these changes, so that changes in non-printable characters do not cause unneeded redraws.
  
  BUG: 376813
  FIXED-IN: 5.15.1

TEST PLAN
  `kwrite /tmp/Test😣.txt` shows correct title. I also tested actual non-printable characters, such as 0x1A, and these are correctly omitted.

REPOSITORY
  R108 KWin

REVISION DETAIL
  https://phabricator.kde.org/D19052

AFFECTED FILES
  client.cpp

To: cfeck, #kwin
Cc: kwin, jraleigh, GB_2, mkulinski, ragreen, jackyalcine, Pitel, iodelay, bwowk, ZrenBot, ngraham, alexeymin, lesliezhai, ali-mohamed, hardening, jensreuterberg, abetts, sebas, apol, mart
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.