WebFaction
Community site: login faq

hello,

i have a chatbot application with two MySql DBs: 1. db for the django backend. 2. chatbot_brain for the chatbot background knowledge.

Basically, when the user start the conversation:

 1. the chatbot.py gets the input using model's value_list()
 2. stretch for a matching input in chatbot_brain 
 3. update with the replay using model.

i have two issues:

  1. is when i try to find the matching string using LIKE query, it produce this EROR message: -- UnicodeEncodeError:'latin-1' codec can't encode character-- I have tried many solutions such ass using (charset='utf8') in the connection but it made the website very slow after i restart the server, and cursor.execute("set names 'utf8'")
  2. when i try to write the conversation in CSV file i got these symbols "ØŸ ØŸ"

Also, i checked that when i created the DB the encode is utf8 but when i opened phpMyAdmin a saw in both DBs :

  chatbot_brain=>utf8_general_ci
  information_schema=>utf8_general_ci
  Total: 2=>    latin1_swedish_ci

So, the chatbot can't find the matching string i don't know where the problem is because before i was using sqlite3 and everything was working. I'm using Django 10, python3 and pymysql to connect to the DB and my language is Arabic.

asked 26 Apr, 16:57

eman_saad's gravatar image

eman_saad
111
accept rate: 0%

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×882
×331
×164

question asked: 26 Apr, 16:57

question was seen: 387 times

last updated: 26 Apr, 16:57

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2016 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM