Closed omarhassanatef closed 7 years ago
If you are using windows:
you can try to run this command (in the cmd) before launching the script:
chcp 1256
It will change windows page code for arab
you can get rid of the error (but it will not fix everything) :
x1.encode(sys.stdout.encoding, errors='replace')
I also heard about a module called "win-unicode-console" for windows (install with pip) but I did not try it
i am using python 3.4
its working on windows , but when i try to insert it in my facebook messenger chatbot online , nothing happens
can you help?
I can't help without informations, (like errors code, sample code to highlight the problem)
could you paste your code on gist.github.com or pastebin.com ?
this is my full chatbot code , its supposed to receive the user messsage ( text_message ) and then using your mtranslate , translates it and re-set the value of text_message to the new translation and then re send it to the user
but it just stops responding can you see something wrong ?
I can't use your code if you don't paste it in a proper way github comments syntax breaks it
https://github.com/omarhassanatef/chatbot
sorry im new to github :D , here it is
It is not working because message_text is not defined
Update?
the issue was with that the text was ascii code , it needs to be UTF-8 , it works perfectly
from mtranslate import translate x = message_text def main(): to_translate = x x1 =(translate(to_translate)) x2 =(translate(to_translate, 'ar'))
if name == 'main': main()