ensure that content type and character encoding are set before the writer is obtained