Added support for different codepages. Fixes #29