-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
Description
Feature Request
Output of import pydantic.utils; print(pydantic.utils.version_info()):
pydantic version: 1.5.1
pydantic compiled: True
python version: 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)]
platform: Windows-7-6.1.7601-SP1
optional deps. installed: ['email-validator']
Description
Hi, there's known problem on Windows with parsing dotenv files - pypa/pipenv#1963. python-dotenv would parse files with default encoding (cp1251 for Cyrillic Windows). As a result we get Лист 1 instead of Лист 1.
It looks like this function need to fetch encoding from Config class somehow.
Example
.env file (UTF-8):
foo=Лист 1
Code snippet:
import pydantic
class Settings(pydantic.BaseSettings):
foo: str
class Config:
env_file_encoding = 'utf-8'
settings = Settings(_env_file='.env')
print(settings)
# foo='Лист 1'