Fix for encoding bug in Python scanner.