Thank you all for the response.
I will try to elaborate on this. All I want is to parse an xml file
which contains special characters. But my parser fails because it cannot
open the file correctly (because of the special characters). So I
decided to write the file contents to a new file by removing the special
characters and then parse it. My sample input file(input.xml) with
special characters is as follows:

<configuration><database>
<step type="general" datetime="Thu Jul 07 23:44:48 -0600 2011">
  <message>Validating element: %F0wt^b%99%90%94%D4N%8D%FA%8A%EE%81_g%9B@I%E3%F6%FCp%AFX%BD%80%91%B5pEK%C9!j%D3%F3SY%C3%F6B~%C8%FC
^%87%C4%F2]! %B9%DF=%E7Y%B9</message>
</step>
</database></configuration>

My desired output file(output.xml) should be something like this:
<configuration><database>
<step type="general" datetime="Thu Jul 07 23:44:48 -0600 2011">
  <message>TEXT REMOVED</message>
</step>
</database></configuration>

I have the following code in place in an attempt to do this:
------------------------------------------------------------
    fin = File.new("input.xml", "rb")
    fout = File.new("output.xml", "w")
    while (line = file.gets)
  temp = line.gsub(/\<message\>Validating element:(.*?)\<\/message\>/,
'TEXT REMOVED')
        fout.puts "#{temp}"
    end
    fin.close
    fout.close
------------------------------------------------------------
But the above code replaces the "<message>.....<message>" content all
together and my output.xml file is:
<configuration><database>
<step type="general" datetime="Thu Jul 07 23:44:48 -0600 2011">
</step>
</database></configuration>

My problem is solved as I am not using the message tag in my parser. But
ideally I want to remove only the content between the message tag without
removing the tag all together. If anyone knows how to do it(preferably
in a single line) please share it with me.

Thanks in Advance,
Rousan