#25135·wxWidgets

Change type of `wxKeyEvent::m_uniChar` to `wxUniChar`

Author: vadzCreated Feb 1, 2025Updated Sep 17, 2026

While looking at #25128 I've realized that we have a problem with char events: they can't represent characters such as `` (U+1F60A) which can't fit in a single wxChar on the platforms using 16 bit wchar_t, i.e. MSW.

And this looks like a real problem because even though such characters can't be entered from physical keyboards (I think?), they definitely can be entered from on-screen keyboards and can also be pasted.

So I think we need to do one of

  1. Change type of m_uniChar to wxUniChar. This has the advantage of simplicity and consistency, but will break existing code if only because switch ( event.GetUnicodeKey() ) won't work any longer.
  2. Change type of m_uniChar to wxUint32. This should be mostly compatible, AFAICS, but I can still imagine some code that would be broken by this, the simplest example being passing the key value to some overloaded function.
  3. Keep m_uniChar as is, and add some m_uniChar32. This has the advantage of being 100% backwards-compatible, but ugly and confusing. But if we could come up with some better name than GetUnicodeKey32() for it, maybe it could work? GetUniChar(), perhaps?

What do people think?