Skip to content

Conversation

@2rtfm
Copy link

@2rtfm 2rtfm commented Nov 6, 2025

Specify UTF-8 encoding when opening the collection file.
The collection file specified 'utf-8' when writing, but no encoding was specified when reading.

    def save_to_disk(self, path: Path) -> None:
        """Save the request model to a YAML file."""
        content = self.model_dump(exclude_defaults=True, exclude_none=True)
        yaml_content = dump(
            content,
            None,
            sort_keys=False,
            allow_unicode=True,
        )
        path.parent.mkdir(parents=True, exist_ok=True)
        path.write_text(yaml_content, encoding="utf-8")
def load_request_from_yaml(file_path: str) -> RequestModel:
    """Load a request model from a YAML file.

    Args:
        file_path: The path to the YAML file.

    Returns:
        RequestModel: The request model loaded from the YAML file.
    """
    with open(file_path, "r") as file:
        data = load(file, Loader=Loader)
        return RequestModel(**data, path=Path(file_path))

Specify UTF-8 encoding when opening the file.
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