Encodings and codepages proposed changes for issue #25

Validate encoding and set codepage appropriately. Add documentation on encodings and include test cases.