Small fix for charset failing in constructor

charset currently fails when used from the constructor. Failing unit test and trivial fix added.