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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Rastislav Kiss

Pages: [1]
1
General / Re: Utf-8 coding problem
« on: February 03, 2018, 08:28:03 pm »
Hi,
thanks for quick ansver. :)
In Slovak language, š character for example do have ascii code 154. It is a locale dependant thing, for example in english ascii table is 154 some other character.
I thought, that toansi method will extract from utf-32 string all characters supported by the local ansi table and insert them to an std::string.
For example, if SF::String does contain 353 character (š in utf-32), there would be std::string with 154 character as a result of toansi.
Or it isn't what toansi method does? I need conversion like this to manage non-utf modules of the program, like tts synthetiser, but also saving to and loading from files, used by other programs like g++ for example.

Thank you in advance.

Best regards

Rastislav

2
General / Utf-8 coding problem
« on: February 02, 2018, 08:13:44 pm »
Hi all,
I am Rastislav Kiss, new on this forum. I would like to ask an question about problem I have encountered in SFML.
I am trying to create a simple app, which will show the window and catch all pressed keys as the characters to collect user input.
Window is fine, but the writing part is a problem. My code for events catching looks as follows:

      while (window.pollEvent(event))
         {
         if (event.type==sf::Event::TextEntered)
            {
            textbuffer+=event.text.unicode;
            }
         }

where textbuffer is an SF::String. I have also one method, which retrieves currently typed text

std::string get_characters()
   {
   std::string output=textbuffer.toAnsiString();
   textbuffer="";
   return output;
   }

It works, until I type some special characters of the Slovak language. If I do so, after some tests I found out, that key is catched and represented properly, but conversion to ascii fails. Characters like š, č or ť are not present in result string, although for example ý is represented correctly.
It is a bug in SFML, or just I'm doing something wrong? If yes, can you please tell me, how to do it correctly?

Thank you in advance.

Best regards

Rastislav

Pages: [1]
anything