Track unicode words from Twitter using Ruby and the Tweetstream API
        Posted  
        
            by Régis B.
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Régis B.
        
        
        
        Published on 2010-06-12T14:44:48Z
        Indexed on 
            2010/06/12
            14:52 UTC
        
        
        Read the original article
        Hit count: 319
        
I am trying to track a set of keywords from Twitter by using the Streaming API (can't post the link here because of spam limitations: google twitter streaming API).
I am doing this inside Ruby, using the TweetStream gem: http://bit.ly/cODAWI
The problem I have is that I want to track keywords that contain some unicode/UTF-8 characters. For instance:
require 'rubygems'
require 'tweetstream'
TweetStream::Client.new("my_user_name", "my_password").track("é") do |s|
 puts s.text
end
(you can try it out, provided you installed the tweetstream and json gems)
This piece of code does not print anything, while replacing "é" with "e" outputs a bunch of tweets continuously.
I did not find any reliable documentation about Unicode in Ruby, so I have no idea where the problem comes from.
Thanks for your help!
© Stack Overflow or respective owner