Specify a character set (with tests)

Took a stab at expanding on pull request #41 by @pathawks since I would like to see it merged as well.