Added ability to specify charset