set encoding and status error

we now set encoding and error status code