https://bugs.kde.org/show_bug.cgi?id=526407

            Bug ID: 526407
           Summary: UnicodeDialog silently truncates supplementary-plane
                    characters (> U+FFFF)
    Classification: Applications
           Product: kdenlive
      Version First git-master
       Reported In:
          Platform: Microsoft Windows
                OS: Microsoft Windows
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: Rendering & Export
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

UnicodeDialog in the Title Clip editor has two related bugs that prevent
supplementary-plane Unicode characters (emoji, CJK Extension B, and any
character above U+FFFF) from being inserted:

1. MAX_LENGTH_HEX is set to 4, limiting hex input to 4 digits. This makes
   the full Unicode range (U+10000–U+10FFFF) unreachable through the dialog.

2. In slotTextChanged() (~line 341 of unicodedialog.cpp), the selected
   character is displayed using:
       unicodeChar->setText(QChar(value));
   QChar is a 16-bit type. For values > 0xFFFF, this silently produces
   the wrong glyph (the lower 16 bits of the value) instead of the
   intended character. No error or warning is shown.

3. The InputDec (decimal) input method has a // TODO Validator comment
   and is completely unimplemented, making that mode non-functional.

Additionally, the updateOverviewChars() function uses QChar(unicode ± i)
for neighbour character display, which has the same 16-bit truncation bug.

Proposed fix:
- Raise MAX_LENGTH_HEX to 5 (covers U+10FFFF = "10ffff", 6 chars but
  we only need 5 for the max valid value "10ffff").
- Replace QChar(value) with QString::fromUcs4(&value, 1) throughout.
- Add MAX_UNICODE_V2 = 0x10FFFF constant for range checks.
- Implement the InputDec validator (simple [0-9]* regex, max length 7).

Reproducible: open Title Clip editor > Insert Unicode character >
type "1F600" > the emoji is not shown and not inserted correctly.

Version: master (fd2da39516)
OS: Any (bug is in Qt/C++ logic, not OS-specific)

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to