Skip to content

Add fallback decoding for STEP file loading#12

Open
Rakshachauhan-10 wants to merge 1 commit into
mozman:masterfrom
Rakshachauhan-10:feature/robust-step-encoding
Open

Add fallback decoding for STEP file loading#12
Rakshachauhan-10 wants to merge 1 commit into
mozman:masterfrom
Rakshachauhan-10:feature/robust-step-encoding

Conversation

@Rakshachauhan-10

Copy link
Copy Markdown

This PR improves readfile() by trying a small set of common legacy encodings when opening STEP files.

Currently, readfile() only attempts to read files using the default STEP encoding.
In practice, some exported STEP files are encoded using legacy encodings such as Latin-1 or CP1252, which causes a UnicodeDecodeError before parsing begins.

This change attempts the following encodings in order:

  • UTF-8 (default)
  • Latin-1
  • CP1252

If all decoding attempts fail, the last UnicodeDecodeError is re-raised.

Notes

  • Existing behavior for successfully decoded files is unchanged.
  • All existing tests pass after this change.

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.

2 participants