views:

181

answers:

1

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?

+2  A: 

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

Carl Norum
Ah, I see. I'm using Windows. How can I see these colors in my console? Is there an emulator you recommend? If I can't, then do you know how I can disable them because they're very ugly this way.
picardo
@picardo, I'm afraid I'm not much of a windows guy. I use cygwin when I do have to be on a windows machine and that works fine. You might have better luck asking on http://www.superuser.com
Carl Norum