Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
thenullpointer opened this Issue · 4 comments

3 participants

@thenullpointer

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

@LaurentGomila

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
@retep998

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

@LaurentGomila

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.

@LaurentGomila

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
Something went wrong with that request. Please try again.