I'm transferring the project from Windows to Raspberry Pi. On Windows the code works without problems, on Raspberry there is an error, I can’t understand what’s wrong
Here is the type of error in django
UnicodeEncodeError at /documents/create
'ascii' codec can't encode characters in position 21-30: ordinal not in range(128)
Request Method: POST
Request URL: http://localhost/documents/create
Django Version: 3.1.4
Exception Type: UnicodeEncodeError
Exception Value:
'ascii' codec can't encode characters in position 21-30: ordinal not in range(128)
Exception Location: /usr/lib/python3.9/zipfile.py, line 1239, in init
Python Executable: /home/remote/test/test2env/bin/python
Python Version: 3.9.2
Python Path:
['/home/remote/test',
'/usr/lib/python39.zip',
'/usr/lib/python3.9',
'/usr/lib/python3.9/lib-dynload',
'/home/remote/test/test2env/lib/python3.9/site-packages',
'/home/remote/test/Django',
'/home/remote/test/test2env']
Server time: Thu, 23 Nov 2023 20:50:35 +0000
Unicode error hint
The string that could not be encoded/decoded was: ok_Петренко_23_1
As you can see the error occurs in a place where there are both Latin and Cyrillic symbols.
This is part of the code, when saving a file I get this error, on Windows everything works without problems
I'm transferring the project from Windows to Raspberry Pi. On Windows the code works without problems, on Raspberry there is an error, I can’t understand what’s wrong
Here is the type of error in django
UnicodeEncodeError at /documents/create 'ascii' codec can't encode characters in position 21-30: ordinal not in range(128) Request Method: POST Request URL: http://localhost/documents/create Django Version: 3.1.4 Exception Type: UnicodeEncodeError Exception Value:
'ascii' codec can't encode characters in position 21-30: ordinal not in range(128) Exception Location: /usr/lib/python3.9/zipfile.py, line 1239, in init Python Executable: /home/remote/test/test2env/bin/python Python Version: 3.9.2 Python Path:
['/home/remote/test', '/usr/lib/python39.zip', '/usr/lib/python3.9', '/usr/lib/python3.9/lib-dynload', '/home/remote/test/test2env/lib/python3.9/site-packages', '/home/remote/test/Django', '/home/remote/test/test2env'] Server time: Thu, 23 Nov 2023 20:50:35 +0000
Unicode error hint The string that could not be encoded/decoded was: ok_Петренко_23_1
As you can see the error occurs in a place where there are both Latin and Cyrillic symbols. This is part of the code, when saving a file I get this error, on Windows everything works without problems
on Windows locale.getdefaultlocale() ('ru_RU', 'cp1251') sys.getdefaultencoding() 'utf-8'
on Raspberry I tried similar parameters, and changed locale.getdefaultlocale() to utf-8, no change, same error