title: How to open a text file that has emojis in it?
body: <p>I´m trying to do the simplest thing, open a file, read and close it in python. Simple. Well this is the code:</p>
  <pre><code>name_file = open(&quot;Forever.txt&quot;, encoding='UTF-8')
  data = name_file.read()
  name_file.close()
  
  print (data)
  </code></pre>
  <p>I know that this texts has emojis in it like hearts, etc. The thing is that this emojis are not in there unicode syntax like U+2600 , they are placed as little images. I think the following error is because of this little images:</p>
  <pre><code>return codecs.charmap_encode(input,self.errors,encoding_table)[0]
  UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f681' in         
  position 2333: character maps to &lt;undefined&gt;
  </code></pre>
  <p>I tried the following, without specifyng encoding:</p>
  <pre><code>name_file = open(&quot;Forever.txt&quot;)
  </code></pre>
  <p>And the error changed to this:</p>
  <pre><code>UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 2303: character maps to &lt;undefined&gt;
  </code></pre>
  <p>No idea why is this happening.</p>
  <p>Maybe one solution would be to save in a variable everything that is test and deleting the rest...mmm.</p>