Open Frank-Krick opened 6 years ago
Seems related to #53. I'm not familiar with how Python handles encodings on Windows, but on Linux, it uses the default encodings specified by the OS/environment.
Yes, that seems to be the same issue. The python 3 interpreter used the encoding returned by locale.getpreferredencoding() which on my Windows systems is cp-1252 and on my Linux system is UTF-8. My .mdpp files are encoded using UTF-8 and contain non-ACSII characters so python on Windows can't read them. The fix described in #53 would work but only for python 3.
I might have a fix for this here https://github.com/VincenzoLaSpesa/markdown-pp
I exposed the encoding
parameter to the MarkdownPP class and now i can call it with:
MarkdownPP(input=infile, modules=['include', 'toc'], output=outfile, encoding="UTF8")
If no encoding is provided it's defaulted to sys.getdefaultencoding()
I will test it a little more and then i will open a merge request.
It seems that the output encoding in Windows is cp1252 by default which creates problems when the source files contain unicode characters if there is no suitable character defined in the charmap.
When I try to process a document containing the character '●' with MarkdownPP on Windows it exits with the following error:
The same input can be processed fine using Linux.