Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How to get unicode to be typed through sf::TextEntered  (Read 2206 times)

0 Members and 1 Guest are viewing this topic.

codinglexernewbie

  • Newbie
  • *
  • Posts: 4
    • View Profile
How to get unicode to be typed through sf::TextEntered
« on: September 24, 2022, 07:46:49 am »
I want to be able to get Unicode letters e.g: ∏ by typing alt + 8719 like possible in Wordpad, but it doesn't seem to work using the default instead it turns into ☼(15), why does it reset after 256?, and is there a way to do what I want in the standard lib?

fallahn

  • Hero Member
  • *****
  • Posts: 507
  • Buns.
    • View Profile
    • Trederia
Re: How to get unicode to be typed through sf::TextEntered
« Reply #1 on: September 24, 2022, 10:47:06 am »
Unicode is complicated - see this post: https://stackoverflow.com/a/50407375/6740859

Broadly speaking std::string is mostly compatible with utf-8 but you may need to convert to/from codepoints when used with sf::String. In my experience I've found it best to try and stick to a unicode aware string class (like sf::String which is, admittedly, not the standard library but supports full 32 bit characters) and only convert when necessary, such as reading or writing a text file.

 

anything