test/py: Fix unicode handling for log filtering