Added extra statement to compare character encoding, needed to be ANDed instead of ORed