UnicodeDecodeError: utf-8 codec can't decode byte 0xce in position 3: invalid continuation byte

I have installed rasa and encountered the problem – ‘utf-8’ codec can’t decode byte 0xce" ,and I try to update the rasa version to 1.6.0 ,but the problem is still here.

I use

python -m rasa_nlu.server -c sample_configs/config_jieba_mitie_sklearn.yml --path models

to start a server and post a request by this

curl -XPOST localhost:5000/parse -d "{"q":"我发烧了该吃什么药?", "model": "model_20191229-202428"}"

and I got the following error:

how could I fix it? Please ,thanks

Unicode String types are a handy Python feature that allows you to decode encoded Strings and forget about the encoding until you need to write or transmit the data. Python tries to convert a byte-array (a bytes which it assumes to be a utf-8-encoded string) to a unicode string (str). This process of course is a decoding according to utf-8 rules. When it tries this, it encounters a python byte sequence which is not allowed in utf-8-encoded strings (namely this 0xff at position 0). One simple way to avoid this error is to encode such strings with encode() function as follows (if a is the string with non-ascii character):

a.encode('utf-8').strip()

Or

Use encoding format ISO-8859-1 to solve the issue.

1 Like

The problem will be solved just run: pip3 install --upgrade rasa == 2.4.3