2

I just began learning RoR using the materials from railstutorial.org. When the author uses the command line, the resulting text are always nicely organized and colored. When I do the same thing, I often get "weird" characters and unorganized text as result.

https://i.stack.imgur.com/a3Jv1.jpg Example

https://i.stack.imgur.com/JghGv.jpg My attempt to do the same

I'm not quite sure what to do to make my command line more organized like the one shown in the tutorial. Any help would be appreciated. In case you need to know, I'm using Windows 7.

jeebface
  • 841
  • 1
  • 12
  • 29

2 Answers2

1

It is because by default Windows command prompt doesn't know about ANSI color Sequences. You can try https://github.com/adoxa/ansicon which is supposed to make it aware. The reason the tutorial authors look like that is they are using a *nix shell that understands the color codes (probably bash or zsh on either linux or osx if I had to guess)

Doon
  • 19,719
  • 3
  • 40
  • 44
1

As Doon pointed out, the Windows console doesn't recognize ANSI sequences. As suggested your best bet right now is to use external tools.

However, since there are some pain points using most of the external tools, Ruby 2.0 will provide support for ANSI escape codes in Ruby out-of-the-box without having to depend on external gems or tools.

Community
  • 1
  • 1
Azolo
  • 4,353
  • 1
  • 23
  • 31