factored out scalar, hash and date-time encoders