The format strings for kcuu1 and kcud1 are incorrect (cursor up and cursor down). These are \EOA and \EOB as reported by infocmp which in binary would be 0x1e, 0x4f, 0x41 and 0x1e, 0x4f, 0x42 respectivly. The key presses however return \E]A and \E]B or 0x1e, 0x5b, 0x41 and 0x1e, 0x5b, 0x42. I have not tested any of the other format strings but i believe that the entire terminfo file for Xterm needs to be revisited and verified.
http://invisible-island.net/ncurses/ncurses.faq.html#cursor_appmode