I have moved to 1.9 long back. Don’t want to move back.
I am on OSX. I think I had probably (?) solved this issue on my
previous laptop (PPC) – now I;ve migrated my user to a new machine
(Snow Leopard). All my settings, should have moved. (I say this since I
had commented out the perl line).
Thanks for the link, i will read it. But NO, i have already read up
enough a few months back, and do not have the energy to do it again :-(.
I can only guess that the external encoding picked up from your
platform’s environment is US-ASCII (are you using cygwin by any chance?)
You probably need to set the external encoding to UTF-8 or BINARY for
your regexp not to crash. Try adding -Ku or -Kn to your ruby command
Ok, I’ve got it. The problem occured when the program was run by cron.
My user setting is UTF and it ran fine in terminal. So now in the
program itself I have set LC_CTYPE and LC_ALL to en_US.UTF-8. Hopefully,
it should work fine now.
So what must i do so this command can run. It runs fine with another
If i replace ruby with perl -pe ‘s|…|g’ that works fine.
I actually run this in a loop with various URLS from cron.
Handling this kind of thing right means tracking encodings right…
which means you’d have to extract the encoding from the http session
and then mark the input as that encoding in your ruby script… and
then deal with the inevitable incompatible encoding errors that would
It sounds to me, tho, like in this case what you have a just some
hacky little scripts and it would be acceptable for them to be
imperfect. So, in that case, I suggest trying to set the encoding for
your source file(s) to BINARY. That’s a hack, but it ought to be
Alternately, you could drop back to the 1.8 interpreter, like Brian
suggests, which more or less uses BINARY as the default source