From: "Y. NOBUOKA" Date: 2011-05-04T22:47:33+09:00 Subject: Re: Encoding nightmare Moreover, you should escape the double quotation characters (") and the ampersand characters (&) in a HTML attribute string enclosed by double quotation characters. So you should use a ERB::Util.h method [1]. require 'ERB' include ERB::Util onclick="remove('<%=h card.name.gsub( "'" ){ "\\'" } %>')" (note the h method next to '=') [1] http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB/Util.html#M000869 Regards, -- NOBUOKA Yu