use code:char instead of val:int