title: Why does emoji have two different utf-8 codes? How to convert emoji from utf-8 , use NSString in ios?
body: <p>We have found an issue, that some emoji have two utf-8 codes, such as:</p>
  
  <pre><code>emoji   unicode    utf-8                another utf-8
        U+1F601    \xf0\x9f\x98\x81     \xed\xa0\xbd\xed\xb8\x81
  </code></pre>
  
  <p>But ios language can't decode the other type of utf-8, so resulting an error when i decode string from utf-8.</p>
  
  <p><a href="https://i.stack.imgur.com/WcdtE.png" rel="noreferrer"><img src="https://i.stack.imgur.com/WcdtE.png" alt="ios code"></a></p>
  
  <hr>
  
  <p>In all documents i found, i can just find one type of utf-8 code for a emoji, no where to find the other.</p>
  
  <p>Documents i referenced includes:</p>
  
  <p><a href="http://apps.timwhitlock.info/emoji/tables/unicode#" rel="noreferrer" title="emoji code">emoji code link</a></p>
  
  <p><a href="http://www.utf8-chartable.de/unicode-utf8-table.pl" rel="noreferrer" title="whole utf-8 code">whole utf-8 code link</a></p>
  
  <p>But in a web tool <a href="http://bianma.911cha.com/" rel="noreferrer" title="bianma">bianma</a>, all the two types of utf-8 code can be converted into emoji correctly.</p>
  
  <p><a href="https://i.stack.imgur.com/tDRez.png" rel="noreferrer"><img src="https://i.stack.imgur.com/tDRez.png" alt="input code"></a></p>
  
  <p><a href="https://i.stack.imgur.com/p24SN.png" rel="noreferrer"><img src="https://i.stack.imgur.com/p24SN.png" alt="ouput"></a></p>
  
  <hr>
  
  <p>So, my question is :</p>
  
  <ol>
  <li><p>Why does there have two types of utf-8 codes for one emoji ?</p></li>
  <li><p>Where has a document which includes the two types of utf-8 codes?</p></li>
  <li><p>How to correctly convert string from utf-8, using NSString in ios language?</p></li>
  </ol>