Having a bunch of files with weird encoding you need to replace something in ?
Pru to the rescue!
(because replacing with ruby-regex or sed leads to encoding exceptions)
find test -name "*" | pru 'return unless File.file?(self); c = File.read(self); s = "SEARCH"; r = "REPLACE"; while x = c.index(s) do; c.slice!(x,s.size); c.insert(x, r); end; File.write(self, c)'
Normal ruby:
String.class_eval do def string_sub(s,r) while x = index(s) do slice!(x,s.size) insert(x, r) end self end end