开发者

Track unicode words from Twitter using Ruby and the Tweetstream API

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

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.


A good part of the answer might be found here: http://groups.google.com/group/twitter4j/browse_thread/thread/49515c9d1b90fa47?pli=1

In short: Twitter Streaming does not support UTF-8 character tracking.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜