title: How does Facebook encode emoji in the json Graph API?
body: <p>Does anyone know how Facebook encodes emoji with high-surrogate pairs in the Graph API?</p>
  
  <p>Low surrogate pairs seem fine. For example, ❤️ (HEAVY BLACK HEART, though it is red in iOS/OSX, <a href="http://i.stack.imgur.com/Ii6V4.png" rel="nofollow">link to image if you can't see the emoji</a>) comes through as <code>\u2764\ufe0f</code> which appears to match the UTF-16 hex codes / "Formal Unicode Notation" shown here at <a href="http://www.iemoji.com/view/emoji/40/smileys/red-heart" rel="nofollow">iemoji.com</a>.</p>
  
  <p>And indeed, in Ruby when parsing the JSON output from the API:</p>
  
  <pre><code>ActiveSupport::JSON.decode('"\u2764\ufe0f"')
  </code></pre>
  
  <p>you correctly get:</p>
  
  <pre><code>"❤️"
  </code></pre>
  
  <p>However, to pick another emoji,  (SLEEPING SYMBOL, <a href="http://www.emoji-cheat-sheet.com/graphics/emojis/zzz.png" rel="nofollow">link to image here</a>. Facebook returns <code>\udbba\udf59</code>. This seems to correspond with nothing I can find on any unicode resources, e.g., for example <a href="http://www.iemoji.com/view/emoji/49/smileys/sleeping-symbol" rel="nofollow">this one at iemoji.com</a>.</p>
  
  <p>And when I attempt to decode in Ruby using the same method above:</p>
  
  <pre><code>ActiveSupport::JSON.decode('"\udbba\udf59"')
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>""
  </code></pre>
  
  <p>Any idea what's going on here?</p>