Todd Burch schrieb:
> Here a whole program that illlustrates the error.  I'm running under 
> Windows Ruby 1.8.5.  (it's ugly and chopped up, but it works... er... 
> doesn't work... er...  you know what I mean)

Hi Todd,

first, in case you don't know, you don't have to terminate statements 
with ";". Second, it's better to fill $ebcdic_chars and $ascii_chars 
once at the beginning of your program and not every time the method 
#doit is called.

Now to your problem: for #tr the letter "-" is special. It lets you 
define character ranges. See the docs for more info. In order to get a 
literal "-" you have to escape it with a "\". The backslash is the 
second part of your problem. You have a single backslash both in 
$ebcdic_chars and in $ascii_chars, and you have to escape that, too.

One way to fix your code would be to double the line

   $ebcdic_chars += 0x5C.chr  # *

so that you get two backslashes (0x5C) in a row, change the line

   $ascii_chars += '-'

to

   $ascii_chars += '\\-'

and finally change the line

   $ascii_chars += '\\'  # escape char is special - must be doubled

to

   $ascii_chars += '\\\\'  # escape char is special - must be doubled

Note that '\\'.size == 1.

Regards,
Pit