write_with_substitution

write_with_substitution(out, input)
Instance Public methods

Writes out text, substituting special characters beforehand. out A String, IO, or any other object supporting <<( String ) input the text to substitute and the write out

z=utf8.unpack("U*")
ascOut=""
z.each{|r|
  if r <  0x100
    ascOut.concat(r.chr)
  else
    ascOut.concat(sprintf("&#x%x;", r))
  end
}
puts ascOut
doc_ruby_on_rails
2015-05-07 16:45:19
Comments
Leave a Comment

Please login to continue.