Added some encoding checking asserts.