It seems Python on non-linux platform, e.g., Mac and Windows, doesn't support Unicode so well. I added another option to specify target encoding if necessary and the default encoding is 'utf-8'. This patch is against Tweet to Text 2.
--encoding=utf-8 - to specify encoding match your terminal.diff --git a/track.py b/track.py index e651f51..1842e61 100644 --- a/track.py +++ b/track.py @@ -52,6 +52,9 @@ class App: parser.add_option('-p', '--pages', default=4, type='int', dest='pages', help='max pages') + parser.add_option('--encoding', + default='utf-8', dest='encoding', + help='output encoding') self.options, self.args = parser.parse_args() @@ -81,7 +84,8 @@ class App: history.reverse() for i in history: - print format_tweet(i) + tweet = format_tweet(i) + print tweet.encode(self.options.encoding, 'replace') if verbose:
I am trying to teach myself how to make a bookmarklet. This is a good chance to make a simple bookmarklet. Please try this simple bookmarklet on any Hi5 profile. Just drag below link to bookmarks toolbar. Note that you need Firefox.
The code is very simple and short.
javascript:(function(){ window.open('http://photo.lullar.com/?q='+encodeURIComponent(location.href)); })();
javascript:(function(){ location.href='http://photo.lullar.com/?q='+encodeURIComponent(location.href); })();
Because of my debate, I found a duplication bug in Tweet to Text that led me to post the fix here.
diff --git a/track.py b/track.py index ea27c2f..e651f51 100644 --- a/track.py +++ b/track.py @@ -65,7 +65,9 @@ class App: query = ' '.join(self.args) results = search(query) for i in results['results']: - history.append(i) + if i['id'] not in keys: + history.append(i) + keys[i['id']] = 1 for p in range(self.options.pages-1): if 'next_page' not in results: @@ -73,7 +75,9 @@ class App: next_page = results['next_page'] results = search(query, next_page[1:]) for i in results['results']: - history.append(i) + if i['id'] not in keys: + history.append(i) + keys[i['id']] = 1
หลังจาก Tweet to Text และ Twitter Debate ดูเหมือนว่าดีเบตจะได้รับความนิยมมากขึ้น วันนี้ตอนสายๆ มีอีกหนึ่งวง วงนี้ใหญ่หน่อย มันเริ่มจากแค่ Chrome มาจบที่ mindset สนุกดี
Submitted by sugree on Wed, 09/03/2008 - 13:20.