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

UTF-8 support in .env #62

Closed
dimadk24 opened this issue Jul 19, 2018 · 6 comments
Closed

UTF-8 support in .env #62

dimadk24 opened this issue Jul 19, 2018 · 6 comments

Comments

@dimadk24
Copy link

Hi, first of all, thanks for nice library! It's awesome software 👍
I need to use UTF-8 in .env and want to use python-decouple for this, but I suppose it won't work with UTF-8, because it doesn't pass encoding param to open function:
https://github.com/henriquebastos/python-decouple/blob/24cc51c7880b79d81b5a75c2d441a41428792aa6/decouple.py#L125
So it will fallback to locale.getpreferredencoding(), as specified in Python docs, which is platform dependent. On my Windows 10 its cp1251, but I want to write UTF-8 in .env and be sure it will be read correctly by python-decouple.
It would be nice, if we could pass encoding kwarg to config() and it will be used in open() (or default if this kwarg is not specified)
Feel free to notify me, if I can help with something

@henriquebastos
Copy link
Collaborator

This seems nice. Can you propose a PR adding a default argument to config to do the trick?

@dimadk24
Copy link
Author

Sure, I'll do it in few days

@farzbood
Copy link

farzbood commented Nov 6, 2019

Hi Guys,
Since you're working on "Encoding", I've a concern on retrieving data from a UTF-8 .env file containing some "Persian/Farsi" string/text. When I get it back by "config()' it turns to another "charset/codpage", I tried to type the text in different editors, but the result is the same. FYI hereby is the original and retrieved values.It would be nice to let me know what's going on. Tnx
Code:config('COMPANY_NAME', default='ایده پردازان ارتباطات نوین')
.env:COMPANY_NAME=ایده پردازان ارتباطات نوین
Original:ایده پردازان ارتباطات نوین
Retrieved by config():'ایده پردازان ارتباطات نوین'

@dimadk24
Copy link
Author

dimadk24 commented Nov 6, 2019

Hi, @farzbood, look like this issue is quite stale. I proposed PR more than year ago (now I see it's completely not ideal and should be updated), and there're no more updates on this

@farzbood
Copy link

farzbood commented Nov 6, 2019

Yeah, I visit that. I will try to contact the owner too.
Thank you for response though.
good Luck

@farzbood
Copy link

Great! It works perfectly nice.
Thank You.
Peace V

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

No branches or pull requests

3 participants