2012-05-10 13 views
0

私のアプリでページを読み込もうとしましたが、以下のエラーが表示されます。私はtweepyを使ってtwitterに接続しています。そして、私はエラーがどこから来たのか、修正する必要があるのか​​分からない。私がこれをどのように解決できるか知りたいです。DjangoのUnicodeEncodeError

UnicodeEncodeError at /test/ 

    'charmap' codec can't encode character u'\u2019' in position 6: character maps to <undefined> 

    Request Method:  GET 
    Request URL:  http://127.0.0.1:8000/test/ 
    Django Version: 1.3.1 
    Exception Type: UnicodeEncodeError 
    Exception Value: 'charmap' codec can't encode character u'\u2019' in position 6: character maps to <undefined> 
    Exception Location: C:\Python27\lib\encodings\cp437.py in encode, line 12 
    Python Executable: C:\Python27\python.exe 
    Python Version: 2.7.2 

Views.py

def testdat(request): 
     if request.method=="GET": 
     treats=Cursor(api.list_timeline, owner=request.user, slug="").items(20) 
     for treat in treats: 
      print "%s\t%s\t%s\t%s" % (treat.text, 
            treat.author.screen_name, 
            treat.created_at, 
            treat.source,) 
      top=Twet(text= treat.text, author_screen_name= treat.author.screen_name, created_at= treat.created_at, source= treat.source) 
      top.save() 
     treats=Cursor(api.list_timeline, owner=request.user, slug='').items(20) 
     return render_to_response('dashy.html',{'treats': treats},context_instance=RequestContext(request)) 

答えて

1

ストップ印刷。あなたのデバッグを行う別の方法を見つけてください。または、まずUTF-8にエンコードします。

関連する問題