Sha256: f18478389004912cc9a564aa77a4130d213ae334a000246244dfa0ad1a717395
Contents?: true
Size: 379 Bytes
Versions: 2
Compression:
Stored size: 379 Bytes
Contents
require 'iconv' module Eightball def eightball string = self.dup string.force_encoding("UTF-8") #http://po-ru.com/diary/fixing-invalid-utf-8-in-ruby-revisited/ ic = Iconv.new('UTF-8//IGNORE', 'UTF-8') string = ic.iconv(string + ' ')[0..-2] #drop the BOM string.gsub!("\xEF\xBB\xBF".force_encoding("UTF-8"), '') string end end String.send(:include, Eightball)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
eightball-0.1.1 | lib/eightball.rb |
eightball-0.1.0 | lib/eightball.rb |