I am working with google appengine python 2.5.
I am experiencing a unicodedecoderror with the following code, because the name myuser has the following meaning
userName = unicode(userName).encode('utf-8') # Àºï¼égãwmj is value in this variable
userName = unicode(userName).encode('utf-8')
strData = '{\"Sid\" :1, \"Oppid\" :%s, \"Aid\" :%s, \"EC\" :\"%s\", \"Name\" :\%s"' % (enemyID, userID, userEmpCode,userName)
params = {'deviceToken' : oDeviceToken,
'message' : strMessage,
'CertificateId' : certificateId,
'Data' : strData
}
result = urlfetch.fetch(url = url,
payload = urllib.urlencode(params),
method = urlfetch.POST,
headers = {"Authorization" : authString},
deadline = 30
)
I am following the steps for the username to encode it in utf-8 so that I can send it as a payload.
username = unicode(username).encode(utf-8)
I believe that an error occurs when I call urllib.urlencode(params)
Please tell us what is going wrong .. or you can ..
and what should be the final strategy for handling unicode string on appengine python ..
I tried different solutions while reading different topics .. but still didn't work
source
share