[core] Decode environment variables with filesystem encoding (Fixes #3854, Fixes #3217, Fixes #2918)

Introduces compat versions of os.getenv and os.path.expanduser
[utils] Add posix expanduser implementation and clarify the original source
Merge branch 'compat-getenv-and-expanduser' of https://github.com/dstftw/youtube-dl into dstftw-compat-getenv-and-expanduser

Conflicts:
	test/test_utils.py
	youtube_dl/__init__.py
Merge branch 'dstftw-compat-getenv-and-expanduser'