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 displays <?> "Character not found" character in Avogadro2 menu entries in Windows 10 #2

Closed
Ineluki80 opened this issue Feb 9, 2024 · 8 comments

Comments

@Ineluki80
Copy link

Source: The menu entries "Configure ..." and "Get xtb ..." use the single unicode character "…"
Problem: Menues in Windows 10 show this character as "�"
Solution: Replace "…" with "..." three consecutive dots in config.py : 201 and install.py : 155

@matterhorn103
Copy link
Owner

This is done to match the other menu items in Avogadro, which have been standardized to use the ellipsis character rather than three full stops/periods. So I'll be keeping it as is.

Obviously the fact that it is displayed incorrectly is a problem that needs fixing, though.

I assume that other menu options with … display correctly for you?

In which case there is some problem in the way that Avogadro gets the options json from plugins. Presumably down to the character encoding used at various stages.

@Ineluki80
Copy link
Author

Ineluki80 commented Feb 12, 2024

Indeed, Avogadro's native menu items show correctly.
But I was able to fix the problem: Inserting the following code in config.py line 41 should do the trick.
sys.stdout.reconfigure(encoding='utf-8')

On Windows, all output to the console (as in print) seems to be automatically converted to CP1257.
See https://stackoverflow.com/questions/3597480/how-to-make-python-3-print-utf8

@matterhorn103
Copy link
Owner

Thanks for digging on this. Seems like it should be an easy fix.

It would be better to fix this on Avogadro's side of things though, as all plugins are going to be behaving the same on Windows.

@Ineluki80
Copy link
Author

Are you going to open the forum thread or shall I do it ?

@matterhorn103
Copy link
Owner

I opened an issue but you're welcome to start the forum thread!

@ghutchis
Copy link

I mean, it's definitely a faster fix to tweak the script. Probably using fromLocal8Bit is needed to interpret the Python script results: https://doc.qt.io/qt-6/qstring.html#fromLocal8Bit

@matterhorn103
Copy link
Owner

True. I added the fix for now.

@Ineluki80 I would appreciate you testing the plugin again. Then I'll make a 0.2.1 release.

@Ineluki80
Copy link
Author

Works beautifully now.

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

3 participants