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: Open metadata with utf-8 encoding #979

Merged
merged 1 commit into from
Jan 28, 2025

Conversation

mferrera
Copy link
Collaborator

@mferrera mferrera commented Jan 28, 2025

Resolves #978

When calling 'open' without specifying the encoding Python will use locale.getencoding() for Python 3.11+ and
locale.getpreferredencoding(False) (with or without the False) for Python 3.8 to determine which encoding to open the file with.

RMS sets this to ANSI_X3.4-1968 (a weird way of saying ascii). This can cause opening the file to fail when non-ascii characters are present within it.

@mferrera mferrera marked this pull request as ready for review January 28, 2025 11:19
@mferrera mferrera self-assigned this Jan 28, 2025
@mferrera mferrera force-pushed the open-metadata-as-utf-8 branch 2 times, most recently from 4ef55b6 to 791a64a Compare January 28, 2025 12:30
@mferrera mferrera requested review from slangeveld and joargr January 28, 2025 12:33
When calling 'open' without specifying the encoding Python will use
`locale.getencoding()` for Python 3.11+ and
`locale.getpreferredencoding(False)` (with or without the `False`)
for Python 3.8 to determine which encoding to open the file with.

RMS in interactive mode sets this to ANSI_X3.4-1968 (a weird way of
saying ascii). This can cause opening the file to fail when non-ascii
characters are present within it.
@mferrera mferrera force-pushed the open-metadata-as-utf-8 branch from 791a64a to a3ede37 Compare January 28, 2025 12:36
Copy link
Contributor

@joargr joargr left a comment

Choose a reason for hiding this comment

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

Looks ok.

@mferrera mferrera merged commit ed26222 into equinor:main Jan 28, 2025
14 checks passed
@mferrera mferrera deleted the open-metadata-as-utf-8 branch January 28, 2025 13:14
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.

Bug(?): failure to open Grid metadata
2 participants