Abeer Sul 0 Newbie Poster

Peace,

In a chat app, received emoticon messages are not showing correctly.

encoded before sending (android):

 URLEncoder.encode(message,"UTF-8")

code for getting messages (PHP)

if ($resultmessage = $db->query($sqlmessage))           
                    {
                    while ($rowmessage = $db->fetchObject($resultmessage))
                        {
                        $out .= "<message  from='".$rowmessage->username."'  sendt='".$rowmessage->sentdt."' text='".$rowmessage->messagetext."' timeSent='".$rowmessage->timeSent."' />";
                        error_log($rowmessage->messagetext."\r\n", 3, "error.log");
                        }
                    }

here, emoticons are printed from php correctly (real emoticons). so far it's all good.

but when trying to display received messages with emoticons, problems accur. either they show up as garbage text or strange characters.

I tried everything I know, reviewed almost every question here about emoticons but to no avail. last thing I tried this:

 URLDecoder.decode(attributes.getValue(MessageInfo.MESSAGETEXT),"UTF-8")
How can I recover the received message?

I need it back just like the message string was sent, so that EmojiconEditText can display emoticons properly.

Note:
  • this only happens when the message has an emoticon
  • emoticons are sent and stored correctly on server database, problem happens when trying to display received emoticons only
  • EmojiconEditText is doing well rendering emoticons
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.