avogadrolibs
avogadrolibs copied to clipboard
Plugin output to console doesn't use Unicode on Windows, Avogadro expects UTF-8
See this issue on the avo_xtb plugin repo, helpfully raised by @Ineluki80.
It seems that on Windows, in at least some cases, the Python stdout stream isn't being encoded in UTF-8 but rather that of the system locale/extended ASCII, which means Unicode characters (e.g. the ellipsis for menu options) are being garbled.
The Python sys docs suggest that actually in many cases, UTF-8 is the default, so I'm not quite sure what's going on. In any case, it looks like there are various ways to enforce Unicode when calling the interpreter e.g. via an environment variable or a command line flag.
Okay, it looks like the code reading from Python scripts needs to use https://doc.qt.io/qt-6/qstring.html#fromLocal8Bit on Windows.
I guess my one concern would be if scripts output UTF-8 (e.g., your recent fix) and Avogadro uses fromLocal8Bit that it again causes problems.
I'll add a pull request and we can see what happens