0

I am having a custom field in which I'm storing text and emojis but when I am querying the record its giving unicode character for ex: 🎍 instead of 🎍.

I have already used EncodingUtil.URLENCODE(str,'UTF-8') and EncodingUtil.URLDECODE(str,'UTF-8') but of no use. Please help me with this

4
  • No, as he is already getting the emojis on page load.
    – Navii
    Commented Mar 28, 2019 at 8:31
  • Database is text based, it will only store its unicode value and show you. Even the tool you use to querry if it does not support emoji , you would still see the code. Commented Mar 28, 2019 at 10:33
  • What is the field type of your custom field? What code are you using to retrieve and display the content?
    – David Reed
    Commented Mar 28, 2019 at 12:06
  • @DavidReed I am using just a long textarea type of field.
    – Navii
    Commented Mar 28, 2019 at 13:10

1 Answer 1

0

I think I got this one, I just needed to append unescapeHtml4() in the string I am showing on the page.

Earlier it was :

String varForVF = objInstance.fieldHavingEmoji;

Corrected one :

String varForVF = objInstance.fieldHavingEmoji.unescapeHtml4();

Now It works fine and I am able to see the emojis on the VFPage.

2
  • Although I had to follow what @oleksandrberehovskyi had suggested because on page rerender emojis were shown like small boxes.
    – Navii
    Commented Mar 28, 2019 at 13:30
  • And thanks everyone for your quick replies.
    – Navii
    Commented Mar 28, 2019 at 13:31

Not the answer you're looking for? Browse other questions tagged .