2012-05-10 3 views
0

내 앱에서 페이지를로드하려고 시도했는데 아래 오류가 팝업됩니다. tweepy를 사용하여 트위터에 연결합니다. 그리고 나는 오류가 어디에서 왔는지 또는 내가 고칠 필요가있는 줄을 모른다. 내가 어떻게이 문제를 해결할 수 있는지 알고 싶다.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로 인코딩하십시오.