change the logic condition for the charset