Welcome Guest, Not a member yet? Register   Sign In
Emojis
#1

(This post was last modified: 01-24-2023, 09:03 AM by gregknight.)

I have an old PHP app that has an email feature.  The problem we are having is the Subject and Message boxes in the email feature will not handle saving emojis to the database or retrieving emojis from the database.  I currently am just setting the subject column in the database to 5 emojis and the word "test" for testing purposes, so I know what I'm working with.  Here is the code doing the insert into the table.  I have set the char_set and dbcollat in the database.php file, but it didn't work, so I've also tried setting it here in the code right before the insert.  It doesn't work either.

        //echo("<script>console.log('PHP MailboxModel saveMessage " . $data['message'] . "');</script>");

        $db['default']['char_set'] = "utf8mb4";

        $db['default']['dbcollat'] = "utf8mb4_unicode_ci";

        $query = $this->ci->db->query("SET character_set_connection=utf8mb4");

        $query = $this->ci->db->query("SET character_set_results=utf8mb4");

        $data['subject'] = '❤️???❤️test';

        if (is_null($message_id)) {

            if (!isset($data['date_add'])) {

                $data['date_add'] = date('Y-m-d H:iConfused');

            }

            if (!isset($data['is_new'])) {

                $data['is_new'] = 1;

            }

         

            $this->ci->db->insert(MAILBOX_TABLE, $data);

            $message_id = $this->ci->db->insert_id();

        } else {

            $this->ci->db->where('id', $message_id);

            $this->ci->db->update(MAILBOX_TABLE, $data);

        }



        $this->updateFulltextField($message_id);



        return $message_id;

    }





Here are the rows that were saved to the database.  Notice that the Subject column has ?? instead of the emojis in the middle.



[Image: 67b73d_k8u]
Subject
❤️????????????❤️test


I believe the code is using CodeIgniter version 1.7.0.
// CI Version

define('CI_VERSION', '1.7.0');

Does CI version 1.7.0 even support the inserting and retrieving of emojis into and from the database?
Reply


Messages In This Thread
Emojis - by gregknight - 01-23-2023, 09:37 AM
RE: Emojis - by InsiteFX - 01-24-2023, 01:52 AM
RE: Emojis - by gregknight - 01-24-2023, 09:20 AM
RE: Emojis - by kenjis - 01-24-2023, 05:14 PM
RE: Emojis - by gregknight - 01-25-2023, 08:53 AM
RE: Emojis - by gregknight - 01-25-2023, 11:41 AM
RE: Emojis - by InsiteFX - 01-26-2023, 01:07 AM
RE: Emojis - by gregknight - 01-27-2023, 11:58 AM
RE: Emojis - by InsiteFX - 01-28-2023, 12:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB