Skip to content
  • Christoph Feck's avatar
    Fix captions with non-BMP characters · 57440d1d
    Christoph Feck authored
    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.
    
    Unit tests adapted by Vlad Zagorodniy.
    
    Test Plan:
    
    kwrite /tmp/Test😣.txt shows correct title. I also tested actual non-printable
    characters, such as 0x1A, and these are correctly omitted.
    
    BUG: 376813
    FIXED-IN: 5.15.5
    
    Reviewers: #kwin, zzag
    
    Reviewed By: #kwin, zzag
    
    Subscribers: zzag, grasslin, kwin
    
    Tags: #kwin
    
    Differential Revision: https://phabricator.kde.org/D19052
    57440d1d