Facebook-graph sdk cannot handle unicode character
Can handle facebook-python sdk when sending Japanese post. I can post in English without any problem, but when I try to post japanese
graph.put_object("me", "feed", message=u'あなたが大好きだよ')
i got below error. What should I do?
Traceback (most recent call last):
File "/base/data/home/apps/s~posttofacebook123456/1.365133296513228525/kay/app.py", line 371, in get_response
response = view_func(request, **values)
File "/base/data/home/apps/s~posttofacebook123456/1.365133296513228525/myapp/views.py", line 116, in index
graph.put_object("me", "feed", message=u'あなたが大好きだよ')
File "/base/data/home/apps/s~posttofacebook123456/1.365133296513228525/myapp/facebook.py", line 140, in put_object
post_args=data)
File "/base/data/home/apps/s~posttofacebook123456/1.365133296513228525/myapp/facebook.py", line 291, in request
post_data = None if post_args is None else urllib.urlencode(post_args)
File "/python27_runtime/python27_dist/lib/python2.7/urllib.py", line 1289, in urlencode
v = quote_plus(str(v))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-8: ordinal not in range(128)
+3
source to share