Added encoding tests to test suite.
Possible fix for issue #1016 - Unicode decode/encode issues