On Feb 20, 2007, at 7:10 PM, Eyal Oren wrote:

> Hi,
>
> I've searched through the newsgroup, found some related stuff (about
> 'string interpolation at will') but couldn't quite figure it out
> completely
>
> My question: I read a string from file, using 'readlines', containing
> special characters, especially \n. These characters are not
> substituted into their binary control characters, e.g. my strings act
> as if created with 'test\abc' instead of "test\nabc".   I would like
> to convert these strings and have Ruby take account of the special
> meaning of the escaped characters, so that I can print them out
> nicely.

Looks like you want something close to String#inspect.

   puts "foo\tbar\n".inspect # -> "foo\tbar\n"

-- fxn