Skip to content

[BUG] Unicode encode error with Gitbash #319

@VinceCabs

Description

@VinceCabs

Hi,

I came accross a strange behaviour when using colorama with in Gitbash.

Here is a test file :

import colorama

print("\N{Heavy Check Mark} check mark")

Standard run is OK :

$ python test_colorama.py
✔ check mark

But stderr is not empty (we get an error) when printing into a file :

$ python test_colorama.py > output.txt
Traceback (most recent call last):
  File "test_colorama.py", line 3, in <module>
    print("\N{Heavy Check Mark} check mark")
  File "C:\[...]\.venv\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 '\u2714' in position 0: character maps to <undefined> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions