Added option to use a custom charset. UTF-8 is still the default charset