Method: Rsmart::ETL.encode
- Defined in:
- lib/rsmart_toolbox/etl.rb
.encode(str, opt = { encoding: "UTF-8" }) ⇒ String
Encodes the input String and replaces invalid or undefined characters.
108 109 110 111 112 |
# File 'lib/rsmart_toolbox/etl.rb', line 108 def self.encode(str, opt={ encoding: "UTF-8" } ) opt[:encoding] = "UTF-8" if opt[:encoding].nil? str.encode( opt[:encoding], :invalid => :replace, :undef => :replace, :replace => "" ) end |