Added error checking in charSize(). Inserted some code comments to remind me how to set the encoding properly