SFML community forums

Help => System => Topic started by: Lupinius on August 26, 2010, 04:05:08 pm

Title: How to use the UTF classes?
Post by: Lupinius on August 26, 2010, 04:05:08 pm
I want to use the TextEntered event, but I don't get how the conversion to letters is supposed to work. Of course, if I wanted to use ASCII I could use char(Event.Text.Unicode), but I want to use extended characters (especially ä, ö, ü and that stuff). I did see the UTF classes, but I have no clue how to use them. What do I have to do to convert Event.Text.Unicode in a character?
Title: How to use the UTF classes?
Post by: Laurent on August 26, 2010, 04:22:51 pm
It depends what encoding you use for your characters (latin-1, UTF-8, UTF-16, UTF-32, ...) and what character/string type you choose to store them (wchar_t/std::wstring, ...).
Title: How to use the UTF classes?
Post by: Lupinius on August 26, 2010, 06:38:14 pm
Originally I just wanted to print it in the terminal, which didn't work because of wrong settings (With the right encoding (latin1 in my case) it works).
But now I want to store it in a string. I tried std::wstring, didn't get anything not ASCII to show up though (displaying letters in a sf::Text btw).

EDIT: Ignore me, I casted the letter to a char somewhere. Storing everything in sf::Uint32 works.