안녕하세요 날이 메시지를 디코딩 할 수 있습니다 무엇을 할 :이 python 오류 메시지를 어떻게 이해할 수 있습니까?
main.py", line 1278, in post
message.body = "%s %s/%s/%s" % (msg, host, ad.key().id(), slugify(ad.title.encode('utf-8')))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)
감사
UPDATE는 인코딩을 제거하려고하는 데이 작업 표시 전화 :
class Recommend(webapp.RequestHandler):
def post(self, key):
ad= db.get(db.Key(key))
email = self.request.POST['tip_email']
host = os.environ.get("HTTP_HOST", os.environ["SERVER_NAME"])
senderemail = users.get_current_user().email() if users.get_current_user() else '[email protected]' if host.endswith('.cl') else '[email protected]' if host.endswith('.mx') else '[email protected]' if host.endswith('.br') else '[email protected]'
message = mail.EmailMessage(sender=senderemail, subject="%s recommends %s" % (self.request.POST['tip_name'], ad.title))
message.to = email
message.body = "%s %s/%s/%s" % (self.request.POST['tip_msg'],host,ad.key().id(),slugify(ad.title))
message.send()
matched_images=ad.matched_images
count = matched_images.count()
if ad.text:
p = re.compile(r'(www[^ ]*|http://[^ ]*)')
text = p.sub(r'<a href="http://\1" rel="nofollow">\1</a>',ad.text.replace('http://',''))
else:
text = None
self.response.out.write("Message sent<br>")
path = os.path.join(os.path.dirname(__file__), 'market', 'market_ad_detail.html')
self.response.out.write(template.render(path, {'user_url':users.create_logout_url(self.request.uri) if users.get_current_user() else users.create_login_url(self.request.uri),
'user':users.get_current_user(), 'ad.user':ad.user,'count':count, 'ad':ad, 'matched_images': matched_images,}))
[UnicodeEncodeError : 'ascii'코덱이 u '\ xa3'문자를 인코딩 할 수 없습니다.] (http://stackoverflow.com/questions/3588083/unicodeencodeerror-ascii-codec-cant-encode-character-u) -xa3) – hop
그 오류에 대해 SO 검색을하면 페이지와 페이지, 페이지 및 페이지와 페이지 및 페이지와 질문 및 답변 페이지 – hop
정보 담당자에게 감사합니다 –