Commit ee43c17fd6d52c523f8a4ef24ca500b903f6d6db
1 parent
a272d983
Exists in
master
Remove iconv dependency
Showing
1 changed file
with
1 additions
and
4 deletions
Show diff stats
twitter/stream.rb
1 | require 'rubygems' | 1 | require 'rubygems' |
2 | require 'twitter' | 2 | require 'twitter' |
3 | -require 'iconv' | ||
4 | 3 | ||
5 | #disable address resolv to avoid problems with proxy | 4 | #disable address resolv to avoid problems with proxy |
6 | class Resolv | 5 | class Resolv |
@@ -11,9 +10,7 @@ end | @@ -11,9 +10,7 @@ end | ||
11 | 10 | ||
12 | #Filters non-UTF8 octets | 11 | #Filters non-UTF8 octets |
13 | def UTF8Filter(string) | 12 | def UTF8Filter(string) |
14 | - ic = Iconv.new('UTF-8//IGNORE', 'UTF-8') | ||
15 | - #Attention please, don't remove + ' ')[0..-2] it is used for UTF8 validation | ||
16 | - ic.iconv(string + ' ')[0..-2] | 13 | + string.encode("UTF-8", :invalid => :replace, :undef => :replace, :replace => "?") |
17 | end | 14 | end |
18 | 15 | ||
19 | def listen_twitter_stream(hub, author_id) | 16 | def listen_twitter_stream(hub, author_id) |