Fix bug in character set difference calculation