# Unicode in \`rasa shell\`

**URL:** <https://forum.rasa.com/t/unicode-in-rasa-shell/51699>\
**Category:** Rasa Open Source\
**Created:** [March 3, 2022, 7:36am UTC](https://forum.rasa.com/t/unicode-in-rasa-shell/51699 "2022-03-03T07:36:50Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![faupotron](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/faupotron/32/20302_2.png) [@faupotron](https://forum.rasa.com/u/faupotron)\
**Post date:** [March 3, 2022, 7:36am UTC](https://forum.rasa.com/t/unicode-in-rasa-shell/51699/1 "2022-03-03T07:36:50Z")

</div>

Hello. I run `rasa shell` and my bot answer to me in json and unicode. Like this:

```auto
Custom json:
{
  "text": "\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430",
  "isEndDialog": "True"
}

```

But the `rasa interactive` command is working normaly. I checked parameters of output in file `rasa\nlu\run.py` . And it’s OK `print(json_to_string(result))` I trained my model with `rasa train`. Why my bot print in unicode and json in `rasa shell`?

Rasa 2.8.21, Rasa SDK 2.8.4, Python 3.8.12, Linux Manjaro

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [March 3, 2022, 11:23am UTC](https://forum.rasa.com/t/unicode-in-rasa-shell/51699/2 "2022-03-03T11:23:17Z")

</div>

Hello @faupotron are you fetching data using .csv ? can you share the code file please, regarding fetching data?

---

<div class="post-metadata">

**Author:** ![faupotron](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/faupotron/32/20302_2.png) [@faupotron](https://forum.rasa.com/u/faupotron)\
**Post date:** [March 3, 2022, 11:28am UTC](https://forum.rasa.com/t/unicode-in-rasa-shell/51699/3 "2022-03-03T11:28:13Z")

</div>

@nik202, no, I run my bot for check how it answer and build dialoges. I do it in terminal, command `rasa shell` I see the message: `Your input ->` and type the message Bot answer to me in json and unicode instead of text

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [March 3, 2022, 11:35am UTC](https://forum.rasa.com/t/unicode-in-rasa-shell/51699/4 "2022-03-03T11:35:55Z")

</div>

@faupotron you are not using custom action? can you activate your env and type `rasa --version` please.

---

<div class="post-metadata">

**Author:** ![faupotron](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/faupotron/32/20302_2.png) [@faupotron](https://forum.rasa.com/u/faupotron)\
**Post date:** [March 3, 2022, 5:36pm UTC](https://forum.rasa.com/t/unicode-in-rasa-shell/51699/5 "2022-03-03T17:36:52Z")

</div>

@nik202 I’ve understood. Of course, I use custom actions. It’s in .yml files (not .csv). rasa --version:

```auto
Rasa Version : 2.8.21
Minimum Compatible Version: 2.8.9
Rasa SDK Version : 2.8.4
Rasa X Version : None
Python Version : 3.8.12
Operating System : Linux-5.4.181-1-MANJARO-x86_64-with-glibc2.17

```

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [March 3, 2022, 6:18pm UTC](https://forum.rasa.com/t/unicode-in-rasa-shell/51699/6 "2022-03-03T18:18:16Z")

</div>

@faupotron I am not doubting your understanding, it’s my way of providing the solution, as this error is regarding UTF-8, etc regarding that why I asked.@faupotron did you create the env for installation Rasa?

Thanks. Nik

---

<div class="post-metadata">

**Author:** ![faupotron](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/faupotron/32/20302_2.png) [@faupotron](https://forum.rasa.com/u/faupotron)\
**Post date:** [March 3, 2022, 6:20pm UTC](https://forum.rasa.com/t/unicode-in-rasa-shell/51699/7 "2022-03-03T18:20:52Z")

</div>

@nik202 Yes, I use conda env and install rasa into conda env

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [March 3, 2022, 6:31pm UTC](https://forum.rasa.com/t/unicode-in-rasa-shell/51699/8 "2022-03-03T18:31:24Z")

</div>

@faupotron share some files, please?

---

<div class="post-metadata">

**Author:** ![faupotron](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/faupotron/32/20302_2.png) [@faupotron](https://forum.rasa.com/u/faupotron)\
**Post date:** [March 3, 2022, 6:32pm UTC](https://forum.rasa.com/t/unicode-in-rasa-shell/51699/9 "2022-03-03T18:32:19Z")

</div>

what kind of file do you mean?

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [March 3, 2022, 6:33pm UTC](https://forum.rasa.com/t/unicode-in-rasa-shell/51699/10 "2022-03-03T18:33:48Z")

</div>

> [@faupotron](#):
>
> rasa\nlu\run.py

rasa\nlu\run.py

What is this file and what code you are using in this?

---

<div class="post-metadata">

**Author:** ![faupotron](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/faupotron/32/20302_2.png) [@faupotron](https://forum.rasa.com/u/faupotron)\
**Post date:** [March 3, 2022, 6:55pm UTC](https://forum.rasa.com/t/unicode-in-rasa-shell/51699/11 "2022-03-03T18:55:20Z")

</div>

@nik202 rasa\nlu\run.py is file from rasa module. It’s located `~/miniconda3/envs/rasa2/lib/python3.8/site-packages/rasa/nlu/` I just finded the same issue and checked this file. But I don’t change it

I drop it to goggle disk: [https://drive.google.com/file/d/1UcVLtrAxTkhhtv3y9RMQWPhylLaDc1Ws/view?usp=sharing](https://drive.google.com/file/d/1UcVLtrAxTkhhtv3y9RMQWPhylLaDc1Ws/view?usp=sharing)

I think that’s not the point

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [March 3, 2022, 7:00pm UTC](https://forum.rasa.com/t/unicode-in-rasa-shell/51699/12 "2022-03-03T19:00:17Z")

</div>

> [@faupotron](#):
>
> I think that’s not the point

You only shared the below piece of information but not with the complete path, for me it can be any custom code.

> [@faupotron](#):
>
> rasa\nlu\run.py

Anyways you are using Miniconda3 and I never used that, I always use anaconda3 for creating a virtual environment, and it’s giving me great results without any issue.

---

<div class="post-metadata">

**Author:** ![raoulvm](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/raoulvm/32/16472_2.png) [@raoulvm](https://forum.rasa.com/u/raoulvm)\
**Post date:** [March 11, 2022, 8:58am UTC](https://forum.rasa.com/t/unicode-in-rasa-shell/51699/13 "2022-03-11T08:58:08Z")

</div>

Hi @faupotronYou are looking in the wrong place. the rasa/nlu/run is used in `rasa shell nlu`, and it is using `json.dumps(..., ensure_ascii=False,...)` by default.

The key here is `ensure_ascii` to be false, because otherwise all unicode, non-ascii, characters will be encoded as shown in your example.

`rasa shell` uses the commandline channel, which uses `rasa.core.channels.console._print_bot_output(message,....)` which uses `json.dumps(message["custom"], indent=2), color=color` in the last but one line. There is no `ensure_ascii=False` parameter here, so it defaults to `True` which means all non ASCII-7 characters will be escaped.

So you can’t do anything about it unless you change that line of Rasa code.

Sorry to say  
BR  
Raoul

---

<div class="post-metadata">

**Author:** ![raoulvm](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/raoulvm/32/16472_2.png) [@raoulvm](https://forum.rasa.com/u/raoulvm)\
**Post date:** [March 11, 2022, 10:41am UTC](https://forum.rasa.com/t/unicode-in-rasa-shell/51699/14 "2022-03-11T10:41:41Z")

</div>

Not entirely true, you can of course write your own interactive channel and use that.

---

<div class="post-metadata">

**Author:** ![faupotron](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/faupotron/32/20302_2.png) [@faupotron](https://forum.rasa.com/u/faupotron)\
**Post date:** [March 15, 2022, 3:59pm UTC](https://forum.rasa.com/t/unicode-in-rasa-shell/51699/15 "2022-03-15T15:59:32Z")

</div>

@raoulvm, hello! Thank you for answer. You gave me the right direction. I found a function that is responsible for the output in the `rasa shell` in the file `rasa/core/channels/console.py` I added the strings:

```auto
str_to_console = message.get("custom")["text"]
rasa.shared.utils.cli.print_color(str_to_console.encode().decode('UTF-8'), color=color)

```

And now my bot answer in console correctly, in right encode
