Skip to content

Conversation

@jjmenet
Copy link

@jjmenet jjmenet commented Nov 22, 2025

This pull request modifies order of assumed encoding when opening wildcard files.

Current logic is opening with ISO-8859-1 then, when error happens, falls back to UTF-8.
In this logic, when there are unicode characters in the wildcard file, it breaks unicode character to Latin-1, breaking unicode characters. When there are lora file with unicode character(for example, 漢字.safetensors), then try to load it, (i. e., lora:漢字:1) braking file names thus fails to load lora.

This change fixes this issue.

Below is summary by copilot.


This pull request updates the file encoding handling logic for reading wildcard .txt and .yaml files in modules/impact/wildcards.py. The main improvement is standardizing the default file encoding to UTF-8 for initial reads and switching to ISO-8859-1 only if a Unicode-related error occurs. This should improve compatibility and reduce issues with file reading across different environments.

File encoding handling improvements:

  • Changed the default encoding to UTF-8 when opening .txt and .yaml wildcard files, and now only fall back to ISO-8859-1 if a yaml.reader.ReaderError or UnicodeDecodeError is encountered. (load_txt_wildcard, load_yaml_wildcard, read_wildcard_dict) [1] [2] [3] [4]
  • Updated exception handling to consistently catch both yaml.reader.ReaderError and UnicodeDecodeError when attempting to read files. [1] [2]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant