This repository was archived by the owner on Dec 19, 2020. It is now read-only.
Add test for unicode branch names.#245
Open
Richard Xia (richardxia) wants to merge 1 commit into
Open
Conversation
Collaborator
|
Nice test branch name 🙂 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 adds a test case that demonstrates a bug when the following conditions line up:
LANG,LC_ALL, others?) don't specify a locale with a UTF-8 encodingMore concretely, I can deterministically break this on Ubuntu 16.04 using the distribution-provided Python 3. I, however, cannot reproduce on my MacBook because Apple's Python 3 defaults to UTF-8.
You can double check if you have a Python installation that is capable of reproducing the problem by looking at the output of the following command:
$ LANG=C python3 -c 'import locale; print(locale.getpreferredencoding(False))'On Ubuntu 16.04, it returns
ANSI_X3.4-1968for me. On my MacBook, it returnsUTF-8.The more detailed error message is:
The issue is that we're setting
universal_newlines=Truein oursubprocess.run()calls, which will check for the encoding of the current locale usinglocale.getpreferredencoding(False). If Git prints out a character that cannot be encoded in ASCII, then Python in an ASCII locale will blow up trying to decode it into a Unicode string.