<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Unicode on Humberto Rocha</title><link>https://humberto.io/tags/unicode/</link><description>Recent content in Unicode on Humberto Rocha</description><generator>Hugo</generator><language>en</language><lastBuildDate>Sun, 20 Nov 2022 15:29:07 -0500</lastBuildDate><atom:link href="https://humberto.io/tags/unicode/index.xml" rel="self" type="application/rss+xml"/><item><title>TLDR: Write and Read Unicode from files with Python 2 and 3</title><link>https://humberto.io/blog/tldr-write-and-read-unicode-from-files-with-python-2-and-3/</link><pubDate>Thu, 23 Aug 2018 00:00:00 +0000</pubDate><guid>https://humberto.io/blog/tldr-write-and-read-unicode-from-files-with-python-2-and-3/</guid><description>&lt;p&gt;Chatting with a friend, &lt;a href="https://twitter.com/queirozMario21"&gt;Mário Sérgio&lt;/a&gt;, about problems that happen when you migrate your codebase from Python versions, I came out with the idea of writing this &lt;strong&gt;TLDR&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;I hope it can help someone that is trying to work with texts that contain &lt;a href="https://en.wikipedia.org/wiki/Unicode"&gt;Unicode&lt;/a&gt; characters that don&amp;rsquo;t fall back into the &lt;a href="https://en.wikipedia.org/wiki/ASCII"&gt;ASCII&lt;/a&gt; table like other than the roman alphabet and &lt;a href="https://en.wikipedia.org/wiki/Emoji"&gt;emoji&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;On Python 2 there&amp;rsquo;s no distinction between &lt;strong&gt;byte&lt;/strong&gt; and &lt;strong&gt;string&lt;/strong&gt;. It leads us to eventually not correctly encode/decode the data when we deal with input and output. That kind of mistake can cause runtime errors like that:&lt;/p&gt;</description></item></channel></rss>