refactor: extract contentType test to method
get charset so we can reencode it properly
refactor: extract to method