xltrail / git-xl

Git extension: Makes git-diff work for VBA in Excel workbooks (xls* file types)
https://www.xltrail.com/git-xl
MIT License
559 stars 72 forks source link

Claasic ‘gbk’ encoding issues for Windows #82

Closed RaidOpe closed 10 months ago

RaidOpe commented 10 months ago

I checked colorama's problem description. It seems that colorama uses ASCII decoding for stdout, Invalid unicode string handling

When diff.py is executed, collecting the modified information can work, but ultimately cannot be decoded to stdout. It is assumed here that before colorama init, determine utf-8stdout

if sys.stdout.encoding.lower() != 'utf-8':
    sys.stdout = open(sys.stdout.fileno(), mode='w', encoding='utf-8', buffering=1)

I look forward to your reply and point out my mistakes.

UnicodeEncodeError: 'gbk' codec can't encode character '\ufffd' in position 19: illegal multibyte sequence [34980] Failed to execute script 'diff' due to unhandled exception! fatal: external diff died, stopping at dd.xlsm

fzumstein commented 10 months ago

This is about #64 so ideally, you'd add your comment there.