1

‍❤️‍ is created combining (\uD83D\uDC69), ❤️‍ (\u200D\u2764\uFE0F\u200D) and another (\uD83D\uDC69) in a single string: \uD83D\uDC69\u200D\u2764\uFE0F\u200D\uD83D\uDC69

How do I convert this String:

\uD83D\uDC69\u200D\u2764\uFE0F\u200D\uD83D\uDC69

to its character representation ‍❤️‍?

This is not a duplicate question. The link to the duplicate is for urls. This is about generating an emoji character. I don't see any relationship between those two. This has nothing to do with escaping a uri. The question is how to decode a zero-width joiner.

Johann
  • 27,536
  • 39
  • 165
  • 279
  • This is not a duplicate. It's not about escaping a uri. – Johann Aug 27 '18 at 10:34
  • If you have a string which literally contains "backslash u d 8 3 d" etc, and you want to turn that into the character that's supposed to represent, then what you want is to *decode a string with escaped unicode*. It doesn't matter that that string represents a URL or an emoji or whatever else. – deceze Aug 27 '18 at 10:34
  • If you still think those solutions don't apply, show us a sample where you try to apply that solution to your situation and how that turned out and why it doesn't apply. – deceze Aug 27 '18 at 10:37
  • 1
    Pedantic note: the `\u200D`s are the Joiners that make the whole thing come together, they aren't part of the heart. – Niet the Dark Absol Aug 27 '18 at 10:38
  • My question is about decoding a zero-width joiner into a single character and not about decoding escaped characters in a uri. Checkout https://en.wikipedia.org/wiki/Zero-width_joiner – Johann Aug 27 '18 at 10:40
  • 1
    OK, so… have you ***tried*** it? `JSON.parse('"\\uD83D\\uDC69\\u200D\\u2764\\uFE0F\\u200D\\uD83D\\uDC69"')` results in ‍❤️‍. – deceze Aug 27 '18 at 10:41
  • That works. Please post it as the answer and remove the "duplicate" note. Thanks. – Johann Aug 27 '18 at 10:46
  • While your solution works, it doesn't work with this: JSON.parse('"\\u1f469\\u200d\\u1f469\\u200d\\u1f466"'). That results in multiple characters. I'm running this in Chrome. – Johann Aug 27 '18 at 11:01
  • "Post it as answer" – That *is* the answer *in the duplicate*. Hence, *duplicate.* If you have a specific question about a specific sequence which doesn't work in that schema, ask about that specifically. – deceze Aug 27 '18 at 11:46

0 Answers0