Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeEncodeError: 'charmap' codec can't encode character '\u2728' in position 19: character maps to <undefined> #22

Open
Bouni opened this issue Sep 30, 2024 · 1 comment

Comments

@Bouni
Copy link

Bouni commented Sep 30, 2024

When I run deadcode.exe . from the terminal, everything works fine

grafik

But if I run the pre-commit hook I get a UnicodeEncodeError

deadcode.................................................................Failed
- hook id: deadcode
- exit code: 1

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\user\.cache\pre-commit\repoavu4w616\py_env-python3.12\Scripts\deadcode.EXE\__main__.py", line 7, in <module>
  File "C:\Users\user\.cache\pre-commit\repoavu4w616\py_env-python3.12\Lib\site-packages\deadcode\cli.py", line 41, in print_main
    if result := main():
                 ^^^^^^
  File "C:\Users\user\.cache\pre-commit\repoavu4w616\py_env-python3.12\Lib\site-packages\deadcode\cli.py", line 36, in main
    print('\033[1mWell done!\033[0m \u2728 \U0001f680 \u2728')
  File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'charmap' codec can't encode character '\u2728' in position 19: character maps to <undefined>

I run Windows 11 + python 3.12

Do you have an idea what's the problem?

Originally posted by @Bouni in #16 (comment)

@Bouni
Copy link
Author

Bouni commented Sep 30, 2024

I found a solution for this and will send a PR in a few minutes

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

No branches or pull requests

1 participant