Skip to content

Commit 5e87dd3

Browse files
Work in progress #8736
1 parent 0950916 commit 5e87dd3

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

pylint/reporters/base_reporter.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ def handle_message(self, msg: Message) -> None:
4242

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

4751
def display_reports(self, layout: Section) -> None:
4852
"""Display results encapsulated in the layout tree."""
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
"""This does not crash in the functional tests, but it does when called directly"""
2+
assert "\U00010000" == "\ud800\udc00"

0 commit comments

Comments
 (0)