Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. File.open( "#{ Rails.root }/tmp/#{ id }", 'w:iso-8859-15:iso-8859-15' ) { |f| f << Model.info_in_iso-8859-15 }
  2. respond_to do |format|
  3. format.text { send_file( route, filename: 'info', type: 'text/plain; charset=iso-8859-15; header=present' ) }
  4. end
  5.  
  6. def normalize_to_iso8859( string )
  7. if string and string.class == String
  8. string.gsub(/[u201cu201d]/, '"').gsub(/[u2013]/, '-').encode( "ISO8859-15" )
  9. else
  10. string
  11. end
  12. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement