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

Author Topic: Unexpected unicode values  (Read 1402 times)

0 Members and 1 Guest are viewing this topic.

ryandaniels

  • Newbie
  • *
  • Posts: 3
    • View Profile
Unexpected unicode values
« on: April 11, 2010, 03:50:52 am »
Probably a very simple question, but I've been searching for a while and haven't been able to answer it.

In my program, I need to get text from the user. I didn't have any problems until I tried typing the '-' character, which returned a value of 276. According to the Unicode tables I've seen, it should have been 45. Quite a few other characters also appear to not match up. So, I'd like to know if there is a different table that matches up with these different values, or simply a way to convert.

Also I'd like to know if there is an existing way to find what a character should be if pushed with the shift key down. (Minor, already have a solution, just somewhat messy)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Unexpected unicode values
« Reply #1 on: April 11, 2010, 09:52:32 am »
Can you show the relevant code? Which other characters give you the wrong value?

Quote
Also I'd like to know if there is an existing way to find what a character should be if pushed with the shift key down

No. Why do you need to do that??
Laurent Gomila - SFML developer

ryandaniels

  • Newbie
  • *
  • Posts: 3
    • View Profile
Unexpected unicode values
« Reply #2 on: April 11, 2010, 02:26:33 pm »
Quote from: "Laurent"
Can you show the relevant code? Which other characters give you the wrong value?

Quote
Also I'd like to know if there is an existing way to find what a character should be if pushed with the shift key down

No. Why do you need to do that??


Upon attempting to copy-paste the code, I discovered my mistake; I had wrongly figured that Event.Text.Unicode could be used if the event was a keypress event. I hadn't been doing this at first, I did it to on a whim to fix an exception, and it seemed to worked, so I forgot about it.

As for your second comment, that was sorta what tipped me off to what I was doing wrong, I thought sfml might already appropriate for when the shift key was pressed, and your incredulity at my question suggested this even more.


In short, everything is working now, thank you.