Getting non-ASCII characters to work in Ren'Py functions
<p>I'm translating a Ren'Py game, which involves redefining a function that converts numbers to written-out words in a particular language. Those strings are then handled and inserted into the game text by the main code of the game (which I can't modify).</p>

<p>My problem is that when I return strings that contain non-ascii characters like <code>Ã¶</code> or <code>Ã¼</code>, the game throws an exception when it gets to that point.</p>

<pre><code>UnicodeDecodeError: 'utf8' codec can't decode bytes in position 2-4: unexpected end of data
</code></pre>

<p>Using character codes like <code>\uC3B6</code> throws no exception, but I end up with a placeholder box instead of the character I want.</p>

<p>Is there any way to make the function return these characters properly without having access to the remaining code?</p>

<p>Turns out I was using the wrong escape character and the wrong hex codes. And I had to use unicode strings. <code>u'\xF6'</code> and <code>u'\xFC'</code> work perfectly fine for the two characters I was trying to get.</p>

python unicode utf-8 renpy