Feneric / doxypypy

A more Pythonic version of doxypy, a Doxygen filter for Python.
GNU General Public License v2.0
149 stars 48 forks source link

Unicode: charmap error for unicode characters when used in doxygen #54

Open cfrings opened 6 years ago

cfrings commented 6 years ago

In Windows, non-ascii unicode characters raise

UnicodeEncodeError: 'charmap' codec can't encode characters in position 8257-8259: character maps to 

Finding inspiration here: https://stackoverflow.com/a/30673656, I've replaced

print(astWalker.getLines())

with

import sys, io
default_out = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
print(astWalker.getLines()), file=default_out)

as a workaround. Not sure this is the best thing to do, but it works.