0

I am trying make my project multilanguage. I install rosetta. When I write django-admin makemessages -l tr, console gives an error:

(myvenv) C:\Users\USER\OneDrive\Documents\GitHub\otc>django-admin makemessages -l tr
UnicodeDecodeError: skipped file QuickStartClientCom.html in .\myvenv\Lib\site-packages\win32com\HTML (reason: 'utf-8' codec can't decode byte 0x96 in position 1724: invalid start byte)
UnicodeDecodeError: skipped file QuickStartServerCom.html in .\myvenv\Lib\site-packages\win32com\HTML (reason: 'utf-8' codec can't decode byte 0x92 in position 2291: invalid start byte)
UnicodeDecodeError: skipped file docindex.html in .\myvenv\Lib\site-packages\win32com\HTML (reason: 'utf-8' codec can't decode byte 0x92 in position 1113: invalid start byte)
UnicodeDecodeError: skipped file misc.html in .\myvenv\Lib\site-packages\win32com\HTML (reason: 'utf-8' codec can't decode byte 0x92 in position 407: invalid start byte)
UnicodeDecodeError: skipped file package.html in .\myvenv\Lib\site-packages\win32com\HTML (reason: 'utf-8' codec can't decode byte 0x85 in position 2807: invalid start byte)
Traceback (most recent call last):
  File "C:\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\USER\OneDrive\Documents\GitHub\otc\myvenv\Scripts\django-admin.exe\__main__.py", line 7, in <module>
  File "c:\users\user\onedrive\documents\github\otc\myvenv\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "c:\users\user\onedrive\documents\github\otc\myvenv\lib\site-packages\django\core\management\__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "c:\users\user\onedrive\documents\github\otc\myvenv\lib\site-packages\django\core\management\base.py", line 330, in run_from_argv
    self.execute(*args, **cmd_options)
  File "c:\users\user\onedrive\documents\github\otc\myvenv\lib\site-packages\django\core\management\base.py", line 371, in execute
    output = self.handle(*args, **options)
  File "c:\users\user\onedrive\documents\github\otc\myvenv\lib\site-packages\django\core\management\commands\makemessages.py", line 382, in handle
    potfiles = self.build_potfiles()
  File "c:\users\user\onedrive\documents\github\otc\myvenv\lib\site-packages\django\core\management\commands\makemessages.py", line 424, in build_potfiles
    self.process_files(file_list)
  File "c:\users\user\onedrive\documents\github\otc\myvenv\lib\site-packages\django\core\management\commands\makemessages.py", line 495, in process_files
    self.process_locale_dir(locale_dir, files)
  File "c:\users\user\onedrive\documents\github\otc\myvenv\lib\site-packages\django\core\management\commands\makemessages.py", line 559, in process_locale_dir
    input_files_list.write('\n'.join(input_files))
  File "C:\Python39\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u0131' in position 8889: character maps to <undefined>

How can fix it? Note: Same problem when launch django-admin makemessages -l en

edche
  • 459
  • 3
  • 17
  • You're running on Windows, so try `chcp 65001` before running that command to set the terminal's default codepage (as used by the `charmap` codec) to UTF-8, or `set PYTHONIOENCODING utf-8` for another approach. See https://stackoverflow.com/questions/492483/setting-the-correct-encoding-when-piping-stdout-in-python for similar answers. – AKX Aug 25 '21 at 10:10

0 Answers0