Skip to content

pre-commit hook does not work on Windows #473

Description

@radoering

When I try to use the pre-commit hook on Windows it always fails with

UnicodeEncodeError: 'charmap' codec can't encode character '\u2705' in position
1: character maps to <undefined>

or

UnicodeEncodeError: 'charmap' codec can't encode character '\u274c' in position
1: character maps to <undefined>

The unicode characters mentioned in the error are ✅ and ❌.

I tried it in cmd, Powershell and Git Bash and always got these errors.

I can reproduce this issue by just creating an empty git repo with just a .pre-commit-config.yaml with:

repos:
  - repo: https://github.com/scientific-python/cookie
    rev: 2024.04.23
    hooks:
      - id: sp-repo-review

and running pre-commit run --all-files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions