e><p>&gt;&gt;&gt; to_unicode_or_bust(ivan_uni)</p>
<p>u’Ivan Krsti\u0107′</p>
<p>&gt;&gt;&gt; to_unicode_or_bust(ivan_utf8)</p>
<p>u’Ivan Krsti\u0107′</p>
<p>&gt;&gt;&gt; to_unicode_or_bust(1234)</p>
<p>1234</p></blockquote>
<p><strong>3. Encode late</strong></p>
<blockquote><p>Encode to &lt;type ‘str’&gt; when you write to disk or print</p>
<p>&gt;&gt;&gt; f = open(‘/tmp/ivan_out.txt’,’w’)</p>
<p>&gt;&gt;&gt; f.write(ivan_uni.encode(‘utf-8’))</p>
<p>&gt;&gt;&gt; f.close()</p></block