Fixed unicode matching and mode guessing