Question: When I run phpunit from a command line, the control characters are being printed out instead of acting like control characters. Take look at this:

```
PHPUnit 3.6.5 by Sebastian Bergmann.

Configuration read from app\phpunit.xml.dist

...

Time: 1 second, Memory: 12.00Mb

‹[30;42m‹[2KOK (3 tests, 3 assertions)
‹[0m‹[2K

```

I assume that signs like `‹[30;42m<` are some kind of control characters and should be used by console in different way (positioning the cursor, deleting characters etc.)

What can be wrong here?

Answer: 
This happens because you have configured phpunit to use colors.

```
<phpunit colors="true"

```

but sadly it is not possible to create colored output on a Windows terminal.

There is an **open issue** [**`to not show those chars on windows where they can't be translated into colors`**](https://github.com/sebastianbergmann/phpunit/issues/429) **on the phpunit issues tracker** and I'm working on a patch for that.

For now all you can do is to ether accept it or to remove the `color="true"` from your phpunit.xml configuration file.
I just recently ran into this same problem in trying to run phpunit from the command line in git bash on windows 7. After conducting some research into possible various solutions I decided to share the solution I chose to implement for myself, here.

You can filter out the ANSI color control characters from git bash. Create a file named `phpunit` (note: the actual phpunit script wasn't in my path and I was mainly running unit tests from intellij only) and put it anywhere in your `$PATH` (I prefer `~/bin` myself but there's no rule about that):

```sh
#!/bin/sh
/path/to/phpunit "$@" 2>&1 | perl -pe 's/(?<=\e\[)2;//g'

```

The [`"$@"`](https://stackoverflow.com/a/1537695/114359) tells bash to take the rest of the arguments passed to the script and forward them to phpunit. The [`2>&1`](https://stackoverflow.com/a/818284/114359) [redirects stderr to stdout](http://www.tldp.org/LDP/abs/html/io-redirection.html#IOREDIRECTIONREF1), ensuring that any control characters generated in producing error output will also be filtered out.

Finally, all of the output produced by phpunit is piped through perl and run through the regular expression [`'s/(?<=\e\[)2;//g'`](https://stackoverflow.com/a/8129450/114359), which strips out the control characters.

The end result is that phpunit runs just fine, regardless of what `<phpunit colors=""` setting you are using.

Hope this helps!