#1966: fixed compile errors and reverted some changes from the last commit which prepared for refactoring to use new Encoding framework