Ascii codec can't decode byte 0xd0 in position

I’m getting this message and found the traceback in the web.log from frappe.

photo_2020-05-01_21-51-48

No clue as how else to solve it, I have tried the locale settings and no luck
Some posts suggest removing non UTF chars from my apps, but I have another instance of ERPNext v12 running perfectly well with them.

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/www/desk.py", line 21, in get_context
    boot = frappe.sessions.get()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/sessions.py", line 130, in get
    bootinfo = get_bootinfo()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/boot.py", line 54, in get_bootinfo
    load_translations(bootinfo)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/boot.py", line 193, in load_translations
    messages = frappe.get_lang_dict("boot")
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 90, in get_lang_dict
    return get_dict(fortype, name)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/translate.py", line 114, in get_dict
    messages = get_messages_from_include_files()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/translate.py", line 474, in get_messages_from_include_files
    messages.extend(get_messages_from_file(os.path.join(frappe.local.sites_path, file)))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/translate.py", line 502, in get_messages_from_file
    message) for message in  extract_messages_from_code(sourcefile.read(), path.endswith(".py"))]
  File "/home/frappe/frappe-bench/env/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 1801299: ordinal not in range(128)

Frappe will load the website and allow me to enter my password and user, but then I get this.

So far my workaround (not a direct solution per se) involved creating a new server and restoring a backup.

I faced the similar issue.
Root cause: What I found was the locale was not installed and configured properly. For me I picked up ubuntu-minimal:18:04 over container which obviously doesn’t have many assumed packages.
Steps I took to resolve.

  • in bash within root or with sudo (if available)…
    apt clean && apt update && apt install -y locales
    locale-gen en_US.UTF-8 # for to be sure of locales available 
    dpkg-reconfigure locales
    
  • choose a UTF-8 locale. say: en_US.UTF-8, en_IN.UTF-8 (Indian EN), hi_IN.UTF-8 (hindi/India)
  • run locale command in bash and should not pop-up any error.
  • restart server/container(lxd/docker) whereever frappe app is installed.
    Hopefully now the issue should go away!