Artisan showing inserting “32m”, “34;4m” and simil

2019-01-15 12:47发布

问题:

I have no idea why but my Git Bash terminal is showing 34m and random numbers in places. Here's a screenshot.

Thanks for any help.

回答1:

Try changing Git Bash options for terminal to xterm-256color. Credit goes to: http://www.techhelp.pw/git-bash-using-laravel-artisan-displays-escaped-characters/



回答2:

Another option is to run the Laravel scripts with the --no-ansi switch, which disables the ANSI codes altogether.



回答3:

It seems like color codes that are not shown correctly:

[34m is blue foreground and [39m is default foreground color.

But you will need a prefixed escape character:

In Bash, the <Esc> character can be obtained with the following syntaxes:

  • \e
  • \033
  • \x1B

See more here: http://misc.flogisoft.com/bash/tip_colors_and_formatting


The same problem is also discussed here: ANSI color escape sequences seem broken for arc in git bash on windows

Basically there are mentioned to hackish fixes:

php artisan tinker | cat 
php artisan tinker | echo -e

A few other resource:

ANSI color in git is not displayed correctly
In Git Bash on Windows 7, Colors display as code when running Cucumber or rspec



回答4:

To Resolve Color issues Download and install this https://github.com/adoxa/ansicon

Steps for Installation:

1)Extract The folder and Navigate to x86/64 (Depends upon your system)
2)Open Cmd
3)ansicon.exe -I

Simple :)



回答5:

It's a GIT version compatibility issue.
In my case, remove the latest version and download and install the GIT version 2.10. problem solved. https://github.com/git-for-windows/git/releases/tag/v2.10.0.windows.1