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

Author Topic: How to filter out weird characters in TextEntered event?  (Read 3286 times)

0 Members and 1 Guest are viewing this topic.

iride

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • Email
How to filter out weird characters in TextEntered event?
« on: April 27, 2016, 05:18:23 am »
Sometimes I get weird symbols like � through TextEntered
How to filter these out?
« Last Edit: April 27, 2016, 05:33:18 am by iride »

DarkRoku12

  • Full Member
  • ***
  • Posts: 203
  • Lua coder.
    • View Profile
    • Email
Re: How to filter out weird characters in TextEntered event?
« Reply #1 on: April 27, 2016, 06:15:52 am »
Where you gets those symbols, printed by the SFML text class or by the system console?
I would like a spanish/latin community...
Problems building for Android? Look here

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: How to filter out weird characters in TextEntered event?
« Reply #2 on: April 27, 2016, 07:54:38 am »
Do they appear with specific keys or randomly?
Laurent Gomila - SFML developer

iride

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • Email
Re: How to filter out weird characters in TextEntered event?
« Reply #3 on: April 27, 2016, 10:07:36 pm »
Sorry it's not that symbol. It's just a square.

For example, I press ctrl + a and display the character in sf::Text and I see a square.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: How to filter out weird characters in TextEntered event?
« Reply #4 on: April 27, 2016, 10:51:13 pm »
Ctrl + <letter> produces an ASCII control character (CTRL + A gives the "start of heading" character, ASCII code = 1). Those are not printable and can easily be filtered out with the std::isprint standard function.
Laurent Gomila - SFML developer

 

anything