throw error if no charset could be set