Skip to content

Commit

Permalink
[fix] Proper encoding of standard output
Browse files Browse the repository at this point in the history
"CodeChecker cmd" commands were crashing if they would print a character
that can't be decoded by the current system encoding.
  • Loading branch information
bruntib committed Jan 8, 2025
1 parent 8421e16 commit 6aaa279
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# -------------------------------------------------------------------------
""" Helper and converter functions for plain text format. """

import locale
import logging
import math
import os
Expand Down Expand Up @@ -176,7 +177,9 @@ def convert(
if source_comment and source_comment.line:
output.write(f"{source_comment.line.rstrip()}\n")

output.write(f"{format_main_report(report)}")
output.write(
f"{format_main_report(report)}"
.encode('utf-8').decode(locale.getlocale()[1] or "utf-8"))
else:
output.write(InvalidFileContentMsg)

Expand Down

0 comments on commit 6aaa279

Please sign in to comment.