Method: String#detect_encoding!
- Defined in:
- lib/charlock_holmes/string.rb
#detect_encoding!(hint_enc = nil) ⇒ Object
Attempt to detect the encoding of this string then set the encoding to what was detected ala force_encoding
Returns: self
27 28 29 30 31 32 |
# File 'lib/charlock_holmes/string.rb', line 27 def detect_encoding!(hint_enc=nil) if detected = self.detect_encoding(hint_enc) self.force_encoding(detected[:ruby_encoding]) if detected[:ruby_encoding] end self end |