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

Open .dockerignore as utf-8 #2519

Closed
wants to merge 1 commit into from

Conversation

carlbordum
Copy link

This should solve docker/compose#7236

@GordonTheTurtle
Copy link

Please sign your commits following these rules:
https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "dockerignore-encoding" git@github.com:carlbordum/docker-py.git somewhere
$ cd somewhere
$ git commit --amend -s --no-edit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

We use `io.open` instead of `open` to support Python 2.7, which does not
have the `encoding` function parameter on `open`.

Signed-off-by: Carl Bordum Hansen <carl@bordum.dk>
@milas
Copy link
Member

milas commented Jul 29, 2022

We now only support Python3 and the file will be opened using the default system encoding:

The default encoding is platform dependent (whatever locale.getpreferredencoding() returns)

https://docs.python.org/3/library/functions.html#open

That said, I think that .dockerignore files are likely implicitly UTF-8 due to the Docker tooling being primarily written in Go, in which strings are kinda sorta UTF-8 if you don't think too hard. So, I'd be willing to accept an updated PR for Python3 for this if it's still causing someone trouble.

@milas milas closed this Jul 29, 2022
@carlbordum
Copy link
Author

I don't think this is a Python 2/3 issue, but an issue because Windows default encoding is not UTF-8.

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.

None yet

3 participants