Check type rather than char class when encoding integers.

Fixes #1, caused by the encoder encoding numeric strings as integers.