Missing ‘a’ character on Windows with rspec and cucumber

Trying to get a windows rails environment going this morning I stumbled upon something interesting – all ‘a’ characters were missing from cucumber and rspec output.
This has something to do with UTF-8 encoding and there’s a ticket and wiki post on cucumber about it, but no solution that I found acceptable.
Everything comes down to having change encoding in the current cmd window. This is achieved via a simple call to chcp 1252, but nobody want’s to do this every time, right?
To get this executed automaticaly and without resorting to serious registry editing, simply add this line to your cucmber.bat and any other batch files that are exhibiting this problem. You can find cucumber.bat in your /ruby/bin folder.
Here’s what it looks like:
chcp 1252 @ECHO OFF IF NOT "%~f0" == "~f0" GOTO :WinNT @"ruby.exe" "c:/ruby/bin/cucumber" %1 %2 %3 %4 %5 %6 %7 %8 %9 GOTO :EOF :WinNT @"ruby.exe" "%~dpn0" %*
10 comments.
I was getting aggravated when I tried to copy and paste the undefined steps. I tried to think of words which didn’t have ‘a’. lol. Thanks!
Thanks for posting this -especially the batchfile trick. I ran into this many months ago, and forgot how I resolved it.
Now on a new machine, and I was seeing the same thing. Didn’t look forward to spending an hour hunting down a fix, and now I don’t have to – this is just what I needed. Worked perfectly – thanks!
Tom
Hi Alex…
I was wondering if your cucumber performance is good enough… Mine (Win Vista 64bit) it’s awful. Even though cucumber tells that the features took only a few hundred of ‘ms’ actually the whole process takes more than 20 seconds….
Have you read about this?
Which version of windows you have?
Btw I’m testing with rspec, rspec-rails and webrat….
Thanks in advance…
A minor tweak is to munge the cucumber.bat file so the first two lines are:
@ECHO OFF
chcp 1252 > NUL
This has the effect of preventing the text Active code page: 1252 from appearing in the console output.
Hi,
The Trick mentioned above adding “chcp 1252″ to cucumber.bat file didn’t work.
Still letter ‘a’ is missing.
I am using
cucumber-0.4.2
watir-1.6.2
Is this Solution meant for Old Version of cucumber?
thanx a lot it worked for me
worked great, thx a lot
Any idea how to fix this for Cygwin?
Thank you, thank you, thank you. This has been driving me mad.
Leave a Reply