From: Eyal Oren Date: 2007-02-22T03:01:41+09:00 Subject: Re: interpolation of escaped characters in strings On 02/22/07/02/07 01:17 +0900, ara.t.howard@noaa.gov wrote: >why are you avoiding eval? > harp:~ > cat a.rb > class String > def double_quote > Thread.new do > $SAFE = 12 > begin > eval('"%s"' % self) > rescue Exception => e > e > end > end.value > end > end > >seems like the obvious thing to so $SAFE is. Thanks, I hadn't thought of using SAFE. My problem is that I encounter not-wellformed strings in the data, e.g. 'hello\', which break evaluation. But now I catch the exception and just return the string un-evaluated, which is fine, because those escape syntaxes are not allowed anyway. So thanks, I've used your solution. -eyal