[core]: Fix bug introduced in commit 222b1f4

* If text was already encoded, the variable encoded_text was
never set and was needed further down in the execution path. This 
should fix the problem.

To reproduce simply use:
.commands