SageTeX UnicodeDecodeError
Hello, Sage community. I've been writing a book with the help of SageTeX. Until yesterday, I was working with SageMath v8.6, and everything work perfectly. Today I downloaded SageMath v8.7 binary for Linux, and replaced the corresponding SageTeX files. But when I tried to compile the book, suddenly I receive an error message:
Traceback (most recent call last):
File "book.sagetex.sage.py", line 5158, in <module>
_st_.endofdoc()
File "/SageMath/local/lib/python2.7/site-packages/sagetex.py", line 276, in endofdoc
m.update(bytearray(line,'utf8'))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 29: ordinal not in range(128)
The only difference from yesterday is the new version of SageMath. Can somebody explain/help me with this matter?
Thanks in advance for your answers!
What is the encoding of your LaTeX source file ? Windows' default of Latin1 is a source of endless problems.
Try to specify UTF-8 as your default encoding for everythng.
Similarly, at the top of your Sage/Python snippets, try placing
# -*- coding: utf-8 -*-
to clarify..HTH,
I am using Linux Ubuntu. My editor (TeXstudio) is using UTF-8 encoding, and I am also using the "utf8" option for the "inputenc" package. The fist line of my "book.sagetex.sage" file is
However, I could reduce the problem to the fact of using accented Spanish words; if I delete the accents, the problem disappears. However, with SageMath v8.6, I didn't have that problem.
By the way,the command
sys.getdefaultencoding()
returns 'ascii'. So I updated my locales to use UTF-8, but nothing changes.Therefore it's a new problem. This bug should be reported on Trac (or, if you can't access trac, on sage-support and/or sage-release...).
Did you restart your session (or reboot) ?