I'm using cypress for test automation and when running a test spec from the Git for Windows bash terminal I get weird characters in the results output:
cypress spec run in Git for Windows bash -
If I run cypress from a Windows command prompt the output characters are correct:
cypress spec run in Windows Command Prompt -
I'm using Windows 7, cypress 5.1.0, and Git for Windows 2.28.0 with mintty 3.2.0
Any thoughts on how to correct this?
The issue is described in this GitHub issue.
The problem is that Cypress is sending UTF-8 encoded text through its
stdout
which is mangled by Windows before being received by Mintty (which is what hostsbash
and runsgit
on Windows).I understand that Mintty doesn't yet instruct Windows to not mangle the
stdout
it processes - (cmd.exe
does, however, which is why it works there) - but we can do that ourselves by changing our Windows OEM Code Page setting using thechcp
program (located atC:\Windows\System32\chcp.com
and yes, that's a.com
, not.exe
). You can add a command to your.bashrc
file so it will always run when you fire up Mintty:Open mintty on Windows - presumably this starts a bash shell.
Go to your home directory (i.e.
cd ~
)Open or create a
.bashrc
file.Put this in the file (update the path to your
chp.com
program as appropriate):Then restart the terminal window and it should work.