SDL 2: How to read shift+X keys?

That describes exactly my problem. I want to know which is the non-shifted key for e.g. !. As you pointed out, this is different between keyboards (1 for US and German keyboards, §(?) for Czech keyboards…).

And I have to do that from a given char (or string).

For now I have done some hacked solution which works in most common cases. But this cannot be the final one. I think SDL should have all the required information internally, it just has to be made accessible via an interface.

old post, i know, but here’s how I approached this:-
// ss is shift keystate
char toasc(char c,bool ss)
{
string co = “`~1!2@3#4$5%6^7&8*9(0)-_=+[{]};:\'\”,<.>/?\\|";
if (!ss) return c;
if (c >= ‘a’ && c <= ‘z’)
return c - (‘a’ - ‘A’);
int n = co.find(c);
if (n != -1)
c = co[n + 1];
return c;
}