Question

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?

Was it helpful?

Solution

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).

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top