From: Robert Klemme Date: 2011-10-22T00:16:20+09:00 Subject: Re: special characters in identifier On Fri, Oct 21, 2011 at 4:26 PM, DM W. wrote: > I am attempting to create data via a ruby script. One of the require > fields I need to populate is named: > (aard.DLL$) > > I tried using: > :"(aard.dll$)".to_sym => "kimchi" but it did not work. I also tried > ":(aard.dll$)".to.sym => "kimchi" > :"(aard.dll$)" => "kimchi" All these are invalid syntaxes - but not because of special characters in the Symbol but rather because you cannot simply do "expr1 => expr2". > Any ideas? I am a novice, but tried searching online for symbol > identifiers with special characters and could not find anything. First, you do not need to append #to_sym: irb(main):001:0> :"(aard.dll$)" == :"(aard.dll$)".to_sym => true Second, maybe you just have the case wrong, because irb(main):002:0> :"(aard.DLL$)" == :"(aard.dll$)" => false Please note also that in all these examples no identifier is involved. The item before "=>" is at best a key in a Hash, e.g. irb(main):003:0> h = {:"(aard.DLL$)" => "kimchi"} => {:"(aard.DLL$)"=>"kimchi"} Can you provide a bit more context that explains what you are trying to achieve? Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/