Ad Widget

Collapse

Cannot update action when using emojis in custom messages.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AlberTUX
    Junior Member
    • Jul 2020
    • 4

    #1

    Cannot update action when using emojis in custom messages.

    I can use emojis in default media message templates, but when I try to do the same in a custom message of an action it returns a SQL insert error:

    Click image for larger version

Name:	zabbix_error.png
Views:	1814
Size:	45.7 KB
ID:	406071
  • tim.mooney
    Senior Member
    • Dec 2012
    • 1427

    #2
    I'm surprised that emojis work in the default media templates.

    You don't say what Zabbix version or database software and version you're using, but if your database is MySQL or MariaDB, I wouldn't expect emojis to work.

    Short answer: the database character set in use for MySQL/MariaDB doesn't support emojis.

    Longer answer: Zabbix wants 'utf8' with MySQL and MariaDB, and for MySQL (and MariaDB, for compatibility with MySQL), the 'utf8' character set doesn't mean true 'UTF-8'. It's actually an alias for a MySQL-defined character set called 'utf8mb3', which is the 3-byte subset of UTF-8. I haven't been able to find a straight answer on whether utf8mb3 is only the Basic Multilingual Plane (BMP), or whether it covers some script beyond the BMP, but either way, emojis are not part of the BMP. For emojis, you need full, true UTF-8, which MySQL/MariaDB calls utf8mb4.

    So, no emoji, no elvish, no Klingon, etc. in your opmessage.message.

    If you want this to change, so that the message fields in Zabbix support full UTF-8, I recommend you submit an enhancement request via https://support.zabbix.com

    Comment

    • AlberTUX
      Junior Member
      • Jul 2020
      • 4

      #3
      I'm sorry, I was not able to modify my post whe I realized I did not add software versions because it was not approved by a moderator.
      I'm using Zabbix 5.0.2 on MariaDB 10.3.22, the Zabbix database is using utf8 charset with utf8_bin collation as per the official install docs.
      I can confirm the default media templates use emojis and they do work, at least via telegram. This is an example of a saved template for that media:

      Click image for larger version

Name:	zabbix_message_template.png
Views:	1846
Size:	17.6 KB
ID:	406084

      I was about to create a bug, but I wanted to confirm this is a real limitation and not a configuration issue on my end.

      thanks
      Attached Files

      Comment

      • tim.mooney
        Senior Member
        • Dec 2012
        • 1427

        #4
        Thanks for supplying your version and database config. Your character set and collation look good and are what you want.

        I don't have 5.0.2 to test (I'm staying with 4.4.x for now), but I believe you -- I just don't understand why it's working as you've described.

        Was this template just part of 5.0.x when you installed, or did you load it from somewhere else, such as: https://git.zabbix.com/projects/ZBX/...media/telegram ? The official template from that source says emojis are not implemented, but that template also doesn't look like it matches the message template you're showing.

        Comment

        • AlberTUX
          Junior Member
          • Jul 2020
          • 4

          #5
          This is a new installation, but the message template was modified from the original. No other changes has been made.

          Originally posted by tim.mooney
          Thanks for supplying your version and database config. Your character set and collation look good and are what you want.

          I don't have 5.0.2 to test (I'm staying with 4.4.x for now), but I believe you -- I just don't understand why it's working as you've described.

          Was this template just part of 5.0.x when you installed, or did you load it from somewhere else, such as: https://git.zabbix.com/projects/ZBX/...media/telegram ? The official template from that source says emojis are not implemented, but that template also doesn't look like it matches the message template you're showing.

          Comment

          • tirsojrp
            Junior Member
            • Dec 2020
            • 2

            #6
            Originally posted by tim.mooney
            Short answer: the database character set in use for MySQL/MariaDB doesn't support emojis.

            Longer answer: Zabbix wants 'utf8' with MySQL and MariaDB, and for MySQL (and MariaDB, for compatibility with MySQL), the 'utf8' character set doesn't mean true 'UTF-8'. It's actually an alias for a MySQL-defined character set called 'utf8mb3', which is the 3-byte subset of UTF-8. I haven't been able to find a straight answer on whether utf8mb3 is only the Basic Multilingual Plane (BMP), or whether it covers some script beyond the BMP, but either way, emojis are not part of the BMP. For emojis, you need full, true UTF-8, which MySQL/MariaDB calls utf8mb4.
            Thanks for the info, using characters up to Unicode 5.2 seems to work just fine, at least on the maps. Anything above that gets truncated when saving the changes.

            Comment

            Working...