Encoding handling [MJ-813]

All tests pass