We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29902
    • 72 Posts
    Hi, we have a web application that is used mainly on mobile phones. The users are writing messages with emojis in a form, posting the form, and MODX is sending it to the database. When the message is displayed on the webpage the emojis is gone. When I check in the database there are no trace of the emoji-"weird-code" there.

    We have tested with a field that is outside modx that post the text with emoji to the database that has the same charset that the MODX database has, utf-8-general-ci, and then the emoji-"strange-code" is posted in the database and I can see it in the field, and when we get the data from the database we get the emoji back and everything works.

    The way we post data to the database is by using xpdo and newObject() and save(). Is there something in that method that strips away the emoji-code from the userinput?

    How can we allow the emoji codes to come unharmed into the database and unharmed out from it?
      ...I believed it was Friday...
      • 38783
      • 571 Posts
      Maybe striptags is switched on for the method of form submission you are using?
        If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

        email: [email protected] | website: https://andytough.com
        • 29902
        • 72 Posts
        Quote from: andytough at Sep 30, 2016, 12:13 PM
        Maybe striptags is switched on for the method of form submission you are using?

        There is something that does it that looks like a stripping of tags. I solved it, but in an ugly way.

        I create a new object and save that, then I connect to the database old school with mysqli and write the field with smileys/emojis into the database.

        When I get the data from the database I have to ask with mysqli and not with $modx->getObject();

        This feels dirty, and I am wondering if there are some fix to the xpdo that let emojis be saved and retreived without stripping them.
          ...I believed it was Friday...