Skip to content

Commit

Permalink
Work in progress pylint-dev#8736
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed Sep 19, 2024
1 parent 0950916 commit 5e87dd3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pylint/reporters/base_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ def handle_message(self, msg: Message) -> None:

def writeln(self, string: str = "") -> None:
"""Write a line in the output buffer."""
print(string, file=self.out)
try:
print(string, file=self.out)
except UnicodeEncodeError:
best_effort_string = string.encode(encoding="utf-8", errors="ignore")
print(best_effort_string.decode("utf8"), file=self.out)

def display_reports(self, layout: Section) -> None:
"""Display results encapsulated in the layout tree."""
Expand Down
2 changes: 2 additions & 0 deletions tests/functional/r/regression_02/regression_8736.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"""This does not crash in the functional tests, but it does when called directly"""
assert "\U00010000" == "\ud800\udc00"

0 comments on commit 5e87dd3

Please sign in to comment.