Skip to content

Commit

Permalink
Fix encoding bug of craweler
Browse files Browse the repository at this point in the history
  • Loading branch information
fangpenlin committed Jan 19, 2011
1 parent 029aa22 commit 523cd8a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion loso/crawlers/hinet_news.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import codecs
import urllib2
import cStringIO as StringIO

Expand Down Expand Up @@ -48,7 +49,7 @@ def crawelCategory(rss_url):
yield ' '.join(getNewsText(link))

def main():
with open('hinet_news.txt', 'wt') as file:
with codecs.open('hinet_news.txt', 'wt', encoding='utf8') as file:
for url in rss_urls:
for text in crawelCategory(url):
print text
Expand Down

0 comments on commit 523cd8a

Please sign in to comment.