Change type check in encode to ctype_digit() for greater compatibility