Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Set console code page to CP_UTF8 on Windows if supported. #3050
Type of change
Description and Context
Previously, we enforced code page 850 for all console input and output, which breaks with non-western scripts. Since more recent Windows shells are able to display Unicode properly, this patch now enforces UTF-8 and falls back to code page 850 only if UTF-8 is unsupported.
Non-Windows systems default to UTF-8, but can override the codec by setting the LANG environment variable to something other than C.
CLI tests testing non-ASCII passwords on the command line still pass (they wouldn't with a wrong console CP). Manual tests with Unicode passwords also yield the desired results.