Module: Tweetwine::CharacterEncoding

Defined in:
lib/tweetwine/character_encoding.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.forget_guessObject



27
28
29
# File 'lib/tweetwine/character_encoding.rb', line 27

def forget_guess
  @guess_external_encoding = nil
end

Instance Method Details

#to_utf8(str) ⇒ Object

Raises:



7
8
9
10
11
# File 'lib/tweetwine/character_encoding.rb', line 7

def to_utf8(str)
  result = str.encode('UTF-8')
  raise TranscodeError, "invalid UTF-8 byte sequence when transcoding '#{str}'" unless result.valid_encoding?
  result
end