mpastell / Pweave

Pweave is a scientific report generator and a literate programming tool for Python. It can capture the results and plots from data analysis and works well with numpy, scipy and matplotlib.
http://mpastell.com/pweave
Other
435 stars 64 forks source link

bug: pypublish incorrectly handles non ascii characters #21

Closed EnricoGiampieri closed 8 years ago

EnricoGiampieri commented 9 years ago

If you use any non-standard ascii character in the text, they are translated with the wrong set of characters. This is more likely an encoding/decoding error.

try any accented letter, like òàùèì, the results on my computer are reliably incorrect (using python3.4, Pweave 0.23)

mpastell commented 8 years ago

Sorry for taking so long with this. I've fixed it for HTML output now. Just make sure the encoding of your source is UTF-8. I will need investigate what to do with pdf output.

mpastell commented 8 years ago

This could be fixed for pdf output by using either luatex or xetex instead of pdflatex (and adding \usepackage{fontspec} to the header).

Any thoughts whether that would be a good solution? I'm not sure how many people would have those installed and if there are some downsides? I mainly still use pdflatex.

mpastell commented 8 years ago

Ok, I fixed this by adding latex_engine option like in Pandoc. Try using:

pypublish -f pdf -e xelatex test.py 

Where test.py contains:

print("òàùèì")