Hello.
I guess this problem should be quite well-known, and I was quite surprised that I didn't find a clear description. Anyway, it does not seem to be here, so here is my question.
Putty (an ssh client for windows) identifies its terminal emulator as "xterm" by default, but the character sequences I get for some keys are not the same as I get in a descent xterm (I've tried twice, on two different machines with two different linux distros). Namely, in putty, shift+up, ctrl+up, and alt+up produce ^[OA, ^[OA, and ^[^[[A, respectively, while in the real xterm they produce ^[[1;2A, ^[[1;5A, and ^[[1;3A, resp. All the same for other arrow keys. Note that the codes for shift+up and ctrl+up produce
the same character sequences, so a program running on the server-side will be completely unable to distinguish between them, whatever configuration I set up on the server-side.
Maybe, I don't know something important (e. g. there is a general and official linux standard called "xterm" and a program also called "xterm", and the program violates the standard, while putty does not), but for me this looks like a bug in putty (if you call yourself "xterm", you should behave like xterm), and I have the intent to report it to putty developers. But first I would like to ask: maybe I really miss something important? It is very strange for me that such a situation (which should have occurred a lot of times to a lot of users) has not been yet reported (I searched through putty bug reports).
PS The same situation is for Fn keys, but for the Fn keys I know how to reconfigure putty so that it sends the same sequences as xterm (even though this is not the deault putty configuration).
PPS I know that there is some terminal setting, which is controlled from inside the terminal (by "printing" a special sequence of characters) and which is called "application mode". I believe that it is related with ncurses, but AFAIK it can also be toggled by hand, by the commands
to turn it on and
to turn it off. Doing this changes the behavior of shift+arrow, etc keys in putty (in the real xterm they stay the same!), but they don't become like in xterm anyway: shift+up, ctrl+up, and alt+up then produce ^[[A, ^[[A, and ^[^[OA, resp.