[core]: Fix bug introduced in commit 222b1f4

* If text was already encoded in utf-8, the variable encoded_text was
never set and was needed further down in the execution path.
Merge pull request #466 from Erethon/feature-fix-bug

[core]: Fix bug introduced in commit 222b1f4