tokuhirom / Test-Pretty

Other
20 stars 17 forks source link

Support Colors under Windows cmd.exe #32

Open lejeunerenard opened 9 years ago

lejeunerenard commented 9 years ago

@zoffixznet noticed problems using Test::Pretty with windows and mentioned it in irc:

23:08 < Zoffix> (in fact, even after I install Test-Pretty on Windows, it's outputting trash instead of pretty unicode, even when I do chcp 65001, which supposedly switches the terminal to utf8)

and posted two screenshots both in Windows 7:

I believe the issue is that cmd.exe doesn't respect ANSI Color Codes and not necessarily an issue of encoding (thought could be investigated as well). Here is an excerpt from the Term::ANSIColor docs:

Note that not all displays are ISO 6429-compliant, or even X3.64-compliant (or are even attempting to be so). This module will not work as expected on displays that do not honor these escape sequences, such as cmd.exe, 4nt.exe, and command.com under either Windows NT or Windows 2000. They may just be ignored, or they may display as an ESC character followed by some apparent garbage.

Perhaps a different module should be used or a fallback module/method for windows only?

I am willing to look into this myself when I find the time. :)