Unicode encodeerror encountered in Python 3

Run a business script locally today, perfect!

Then deploy the script to the server to run, perfect!

Add to crontab timing task, report error!

UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 57-60: ordinal not in range(128)

Then all kinds of methods are checked, according to the blogger’s method can not solve
after a toss, there’s no choice but to use a stupid method. Add the running script to a shell script and add the following two lines of code in front of it. It’s normal! It’s a solution anyway

export LANG="en_US.UTF-8"
export PYTHONIOENCODING=utf-8


Read More: