RT 36540 -- support upper case in hex and binary numbers

Fix for RT 36540 ("0X0D" and the like not parsing as hex numbers) as detailed by Kevin Ryde in the ticket, with tests.