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

Author Topic: How to use the UTF classes?  (Read 3282 times)

0 Members and 1 Guest are viewing this topic.

Lupinius

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
How to use the UTF classes?
« 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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
How to use the UTF classes?
« Reply #1 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, ...).
Laurent Gomila - SFML developer

Lupinius

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
How to use the UTF classes?
« Reply #2 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.

 

anything