SFML community forums

Help => Window => Topic started by: iride on April 27, 2016, 05:18:23 am

Title: How to filter out weird characters in TextEntered event?
Post by: iride on April 27, 2016, 05:18:23 am
Sometimes I get weird symbols like � through TextEntered
How to filter these out?
Title: Re: How to filter out weird characters in TextEntered event?
Post by: DarkRoku12 on April 27, 2016, 06:15:52 am
Where you gets those symbols, printed by the SFML text class or by the system console?
Title: Re: How to filter out weird characters in TextEntered event?
Post by: Laurent on April 27, 2016, 07:54:38 am
Do they appear with specific keys or randomly?
Title: Re: How to filter out weird characters in TextEntered event?
Post by: iride 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.
Title: Re: How to filter out weird characters in TextEntered event?
Post by: Laurent 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.