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

Plugin output to console doesn't use Unicode on Windows, Avogadro expects UTF-8 #1618

Open
matterhorn103 opened this issue Feb 12, 2024 · 2 comments

Comments

@matterhorn103
Copy link
Contributor

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.

@ghutchis
Copy link
Member

Okay, it looks like the code reading from Python scripts needs to use https://doc.qt.io/qt-6/qstring.html#fromLocal8Bit on Windows.

@ghutchis
Copy link
Member

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

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

2 participants