Add encoding as a formal parameter to constructor