add charset checking

closes #7