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

expose encoding with default utf-8 for reading xml files #1084

Merged
merged 2 commits into from
Nov 19, 2023
Merged

expose encoding with default utf-8 for reading xml files #1084

merged 2 commits into from
Nov 19, 2023

Conversation

gboeing
Copy link
Owner

@gboeing gboeing commented Nov 18, 2023

Resolves #1083

It seems that some Windows installations do not open XML files with utf-8 encoding even when 1) the file is encoded as utf-8, 2) the XML declaration states it is utf-8, and 3) the sys.getfilesystemencoding() is utf-8.

This seems to be because the system's locale.getpreferredencoding() sometimes defaults to cp1252 instead. This PR exposes an encoding parameter to the graph_from_xml and features_from_xml functions so a user can manually specify a certain encoding if they need to.

Copy link

codecov bot commented Nov 18, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.83%. Comparing base (ef5d465) to head (ec41824).
Report is 676 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1084   +/-   ##
=======================================
  Coverage   97.83%   97.83%           
=======================================
  Files          27       27           
  Lines        2497     2497           
=======================================
  Hits         2443     2443           
  Misses         54       54           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gboeing gboeing merged commit 715d85d into main Nov 19, 2023
10 checks passed
@gboeing gboeing deleted the win branch November 19, 2023 18:33
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.

UnicodeDecodeError in graph_from_xml on Windows Installations
1 participant