Skip to content

Commit 5d4985b

Browse files
committedJan 16, 2024
handle non UTF-8 characters
1 parent b20546a commit 5d4985b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
 

‎setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626
entry_points={
2727
"console_scripts": ["submit50=submit50.__main__:main"]
2828
},
29-
version="3.1.3",
29+
version="3.1.4",
3030
include_package_data=True
3131
)

‎submit50/__main__.py

+3
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ def setup_logging(level):
100100

101101
def cprint(text="", color=None, on_color=None, attrs=None, **kwargs):
102102
"""Colorizes text (and wraps to terminal's width)."""
103+
104+
# Handle invalid UTF-8 characters
105+
text = text.encode('utf-8', 'replace').decode('utf-8')
103106
# Assume 80 in case not running in a terminal
104107
columns, lines = shutil.get_terminal_size()
105108
if columns == 0:

1 commit comments

Comments
 (1)

satyakodavali commented on Jun 4, 2024

@satyakodavali
Please sign in to comment.