Skip to content

Commit

Permalink
Shorten comments on _decode steps
Browse files Browse the repository at this point in the history
This removes the parenthesized examples from the per-step comments
in the WinBashStatus._decode helper.
  • Loading branch information
EliahKagan committed Nov 28, 2023
1 parent 3303c74 commit e00fffc
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions test/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,6 @@ def _decode(stdout):
# uses the ASCII subset, so we can safely guess a wrong code page for it. Errors
# from such an environment can contain any text, but unlike WSL's own messages,
# they go to stderr, not stdout. So we can try the system ANSI code page first.
# (Console programs often use the OEM code page, but the ACP seems more accurate
# here. For example, on en-US Windows with the original system code page but the
# display language set to fr-FR, the message, if not UTF-16LE, is windows-1252,
# same as the ACP, while the OEMCP is 437, which can't decode its accents.)
acp = _get_windows_ansi_encoding()
try:
return stdout.decode(acp)
Expand All @@ -151,10 +147,7 @@ def _decode(stdout):
except LookupError as error:
log.warning("%s", str(error)) # Message already says "Unknown encoding:".

# Assume UTF-8. If invalid, substitute Unicode replacement characters. (For
# example, on zh-CN Windows set to display fr-FR, errors from WSL itself, if not
# UTF-16LE, are in windows-1252, even though the ANSI and OEM code pages both
# default to 936, and decoding as code page 936 or as UTF-8 both have errors.)
# Assume UTF-8. If invalid, substitute Unicode replacement characters.
return stdout.decode("utf-8", errors="replace")


Expand Down

0 comments on commit e00fffc

Please sign in to comment.