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

encoding not an option using set_key #378

Closed
gbrabelo opened this issue Feb 18, 2022 · 4 comments · Fixed by #379
Closed

encoding not an option using set_key #378

gbrabelo opened this issue Feb 18, 2022 · 4 comments · Fixed by #379
Assignees

Comments

@gbrabelo
Copy link

gbrabelo commented Feb 18, 2022

You can create and read a .env using the main.DotEnv class with an encoding, but the functions of setting key/unsetting do not act accordingly with the encoding set nor have an option to set it. - They both use the rewrite contextmanager

@bbc2
Copy link
Collaborator

bbc2 commented Feb 19, 2022

DotEnv and rewrite are internal objects so I'm going to ignore them for now.

If I understand correctly, what you are looking for is an encoding parameter for dotenv.set_key and dotenv.unset_key, similar to the one dotenv.load_dotenv and dotenv.dotenv_values already have. Is that correct?

If that's what you meant, I can probably consider adding this since it would make sense and should be easy to do.

@bbc2 bbc2 self-assigned this Feb 19, 2022
@gbrabelo
Copy link
Author

That's exactly right! It makes sense cause otherwise you can't edit an env file that was loaded with a different encoding!

@bbc2
Copy link
Collaborator

bbc2 commented Feb 20, 2022

I just opened a pull request (#379). I hope that it will solve your problem.

@gbrabelo
Copy link
Author

Great! Thanks!

@bbc2 bbc2 closed this as completed in #379 Mar 12, 2022
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 a pull request may close this issue.

2 participants