Repository navigation
Parse XML files in bytes mode to avoid encoding error - #1322
Merged
Merged
Conversation
By opening these files in binary mode, the XML parser itself takes care of dealing with the encoding. This allows the following to pass: $ LANG=C python3 test_SeqIO_SeqXML.py Previously this would fail as the default encoding 'ascii' would break on the non-ASCII characters in UTF-8 encoded test file SeqXML/rna_example.xml Closes biopython#1319
By opening these files in binary mode, the XML parser itself takes care of dealing with the encoding. This allows the following to pass: $ LANG=C python3 test_NCBIXML.py Previously this would fail as the default encoding 'ascii' would break on the non-ASCII characters in the names in some of the BLAST references. Closes biopython#855.
Codecov Report
@@ Coverage Diff @@
## master #1322 +/- ##
==========================================
- Coverage 84.44% 84.44% -0.01%
==========================================
Files 318 318
Lines 48772 48779 +7
==========================================
+ Hits 41187 41192 +5
- Misses 7585 7587 +2
Continue to review full report at Codecov.
|
Member
Author
|
CodeCov is getting quite fussy (they have a moving goal post by default, the more we improve our base coverage, the stricter this check becomes). It thinks we dropped two lines of coverage dealing with the |
Member
Author
|
@smsaladi who helped debug this on #855 says he likes the binary mode idea: #855 (comment) |
Member
Author
|
(Sorry for the close/open, I clicked the wrong button) |
Member
Author
|
Thanks Bow |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This would resolve #855 and #1319
A similar approach might work for #1320 and #1321
For testing you need to (temporarily) change the locale settings, e.g. with
LANG=C, see detailed notes on #855.