class REXML::Text
def write_with_substitution out, input
}
end
ascOut.concat(sprintf("%x;", r))
else
ascOut.concat(r.chr)
if r < 0x100
z.each{|r|
ascOut=""
z=utf8.unpack("U*")
+input+ the text to substitute and the write out
+out+ A String, IO, or any other object supporting <<( String )
Writes out text, substituting special characters beforehand.
def write_with_substitution out, input copy = input.clone # Doing it like this rather than in a loop improves the speed copy.gsub!( SPECIALS[0], SUBSTITUTES[0] ) copy.gsub!( SPECIALS[1], SUBSTITUTES[1] ) copy.gsub!( SPECIALS[2], SUBSTITUTES[2] ) copy.gsub!( SPECIALS[3], SUBSTITUTES[3] ) copy.gsub!( SPECIALS[4], SUBSTITUTES[4] ) copy.gsub!( SPECIALS[5], SUBSTITUTES[5] ) out << copy end