Skip to content

Commit

Permalink
handle non UTF-8 characters
Browse files Browse the repository at this point in the history
  • Loading branch information
rongxin-liu committed Jan 16, 2024
1 parent b20546a commit 5d4985b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
entry_points={
"console_scripts": ["submit50=submit50.__main__:main"]
},
version="3.1.3",
version="3.1.4",
include_package_data=True
)
3 changes: 3 additions & 0 deletions submit50/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ def setup_logging(level):

def cprint(text="", color=None, on_color=None, attrs=None, **kwargs):
"""Colorizes text (and wraps to terminal's width)."""

# Handle invalid UTF-8 characters
text = text.encode('utf-8', 'replace').decode('utf-8')
# Assume 80 in case not running in a terminal
columns, lines = shutil.get_terminal_size()
if columns == 0:
Expand Down

1 comment on commit 5d4985b

@satyakodavali
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.