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.
Added code to detect (via the chardet module) file type encoding, then pass the detected encoding to the appropriate '.read_text' function. Also added 'log.info' statements to state which files are being read along with their detected file character encoding
Description
Reason for the change.
If a conda channel's
repodata.jsonfile contains any non-ASCII (e.g. UTF-8) characters, conda defaults to the local workstation regional file encoding. For Linux and Mac, this is typically UTF-8, for Windows, it is the system regional default (cp-1252 Western Latin for most US based Windows systems). If a single conda channel contains a UTF-8 encodedrepodata.jsonfile, it can cause a Windows installed version of conda to fail due to an 'invalid character' being detected. Example: If the unicode character U+201D (the right double quote character) is in therepodata.jsonfile for a channel added to the Windows machine conda environment, conda will fail even a simple command such asconda search pandasThe changes proposed in this
__init__.pyfile merely uses thechardetmodule to detect the file's character encoding, then passes the detected encoding to the appropriate.read_textfunction. Additionallylog.infostatements have been added to provide users with additional insight into which files are being read (cached or downloaded) as well as their detected file character encoding.Lastly, all changes were bracketed by a string of 20 '#' with specific comments added.
Thank you for time and consideration of this request
Checklist - did you ...
I did not do any of the following checklist items as I did not think this change request was significant enough
[ ] Add a file to thenewsdirectory (using the template) for the next release's release notes?[ ] Add / update necessary tests?[ ] Add / update outdated documentation?