Fix encoding issues in tests