Skip to content

Commit b62b1ea

Browse files
committed
handle specific utf-16 encoding for windows
1 parent 22e7c34 commit b62b1ea

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/gitingest/utils/file_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ def _get_preferred_encodings() -> list[str]:
2727
platform's default encoding followed by common fallback encodings.
2828
2929
"""
30-
encodings = [locale.getpreferredencoding(), "utf-8", "utf-16", "utf-16le", "utf-8-sig", "latin"]
30+
encodings = [locale.getpreferredencoding(), "utf-8", "utf-16le", "utf-8-sig", "latin"]
3131
if platform.system() == "Windows":
32-
encodings += ["cp1252", "iso-8859-1"]
32+
encodings += ["utf-16be", "cp1252", "iso-8859-1"]
33+
else:
34+
encodings += ["utf-16"]
3335
return list(dict.fromkeys(encodings))
3436

3537

0 commit comments

Comments
 (0)