Hello,I sincerely want to decode redius character

Hello, Everyone I just connect using TrackerStore That rasa provide.

And I really want to solve this unicode Error…

code is below.

#-- coding: utf-8 --

import redis

import json

r = redis.Redis(host=“localhost”, port=6379, db=0, password=“mypass”, errors=“ignore”)

json_test_dict = r.get(“me”).decode(“utf-8”).strip()

me = dict(json.loads(json_test_dict))

print(me)

And Error appeared like this, UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x80 in position 0: invalid start byte

I dive in to google but still not found. Please help me.

Thank you

We serialise the tracker when storing it in redis (see rasa/tracker_store.py at master · RasaHQ/rasa · GitHub). Thus, you need to deserialise it on retrieval.

You can use the following code snippet:

#-- coding: utf-8 --
import redis
import json
import pickle

r = redis.Redis(host="localhost", port=6379, db=0)

json_test_dict = r.get("default")
dialogue = pickle.loads(json_test_dict)

print(dialogue)

The dialogue is of type Dialogue (rasa/conversation.py at master · RasaHQ/rasa · GitHub). It has a name and a list of events. Hope that helps.