getCharset don't reassign passed argument

Code was changing the value of the passed argument "encoding". New code doesn't alter argument passed and I think is more understandable after the alteration.