Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YaLaFi insists in using \Lib\encodings\cp1252.py even in a UTF-8 environment #252

Open
csrabak opened this issue Aug 3, 2024 · 0 comments

Comments

@csrabak
Copy link

csrabak commented Aug 3, 2024

In a Windows 10, home ed, single language in a CMD shell, where:
C:\>chcp Página de código ativa: 65001

I.e., UTF-8 code page.

When running this per example command line:
py -3 -m yalafi.shell --server lt --output plain --encoding UTF-8 --language pt-BR text.tex > reslts.text

I get:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Python\Python311\Lib\site-packages\yalafi\shell\__main__.py", line 3, in <module>
    from yalafi.shell import shell
  File "C:\Python\Python311\Lib\site-packages\yalafi\shell\shell.py", line 376, in <module>
    gentext.generate_text_report(proofreader.run_proofreader, sys.stdout)
  File "C:\Python\Python311\Lib\site-packages\yalafi\shell\gentext.py", line 92, in generate_text_report
    output_text_report(tex, plain, charmap, matches, file, out)
  File "C:\Python\Python311\Lib\site-packages\yalafi\shell\gentext.py", line 55, in output_text_report
    out.write('Suggestion: ' + repls + '\n')
  File "C:\Python\Python311\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 '\u2082' in position 13: character maps to <undefined>

Which I cannot understand why YaLaFi "prefers" the CP1252 encoding even if told via command line and the shell in UTF-8!

Is there some way to parametrize YaLaFi to avoid this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant