Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Convert UTF-16 input to UTF-32 on Windows #366

Closed
thenullpointer opened this Issue Mar 13, 2013 · 4 comments

Comments

Projects
None yet
3 participants

WindowImplWin32.cpp line 515, WM_CHAR is being used to set event.text.unicode. The SFML documentation says that event.text.unicode is supposed to be UTF-32 (ie. the library user always gets a plain, unencoded code point). However, the MSDN documentation for WM_CHAR says that the application receives UTF-16.

Forum thread

@ghost ghost assigned LaurentGomila Mar 13, 2013

Owner

LaurentGomila commented Mar 13, 2013

Two ways of solving it:

  • use WM_UNICHAR (only available since Windows XP)
  • if WM_CHAR receives a surrogate, store it and ignore the event; when the second WM_CHAR message is received, the pair is complete, can be converted to UTF-32 and the SFML event can be generated

Do we even want to keep supporting versions of windows older than XP?

Owner

LaurentGomila commented Mar 13, 2013

Do we even want to keep supporting versions of windows older than XP?

As long as it's possible to support them without much effort, yes.

Owner

LaurentGomila commented May 16, 2013

Fixed using the second solution (storing and combining the surrogate pair).

WM_UNICHAR never seems to be generated by Windows itself, apparently only external apps can trigger it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment