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

Fix gnuplot --version encoding handling on Windows #755

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sandersaares
Copy link

In some configurations, gnuplot --version will emit output as UTF-16 bytes instead of UTF-8. This is not expected by parse_version() which always expects UTF-8.

This change enhances parse_version() with a simple fallback - if UTF-8 parsing fails, it will try again with UTF-16.

Fixes #570.

@sandersaares
Copy link
Author

@bheisler @lemmih ping for attention. Would appreciate getting this merged to unblock the feature on Windows.

Copy link
Contributor

@samueltardieu samueltardieu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be simpler when String::from_utf16le() is stabilized. In the meantime, this looks correct, although I cannot test this particular mode because I don't have a Windows box. This doesn't break the Unix tests though.

@samueltardieu
Copy link
Contributor

@sandersaares If you could rebase your PR on the latest master, this would help to have a clean CI build.

In some configurations, `gnuplot --version` will emit output as UTF-16 bytes instead of UTF-8. This is not expected by `parse_version()` which always expects UTF-8.

This change enhances `parse_version()` with a simple fallback - if UTF-8 parsing fails, it will try again with UTF-16.
@sandersaares sandersaares force-pushed the sasaares/fix-gluplot-win-utf16-handling branch from 41dba44 to ce2f85d Compare April 1, 2024 14:56
@sandersaares
Copy link
Author

Rebased

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

Successfully merging this pull request may close these issues.

Can not find gnuplot 5.4 on Windows
2 participants