문제

I am getting very strange outputs from my IRB console. Here it is:

 irb(main):001:0> File.dirname(__FILE__)
 => ←[0;31m"←[0;0m←[0;36m.←[0;0m←[0;31m"←[0;0m

Seems like an encoding issue, right? I am not sure why this is happening. Any ideas how to fix it?

도움이 되었습니까?

해결책

Those are escape codes used to set colors in a terminal program; probably most popularly to colour a prompt in an xterm or compatible terminal. My bash prompt environment variable, for example, looks like this:

PS1="\[\033]2;\w\007\]\[\033[0;31m\]\u@\h \[\033[0;32m\]\!\[\033[0;31m\]> \[\033[0m\]

It looks like some string like that one is getting into your console and confusing it (since it's not bash and/or in an xterm-friendly terminal emulator, I guess).

다른 팁

As Carl and Mike pointed out, that's color information. You can have the colors actually show up if you install ANSICON. Wirble and Cucumber showed up with colored text in their output in a dos box on my Windows machine once I installed that.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top