Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-10929

Can't use unicode in LLD JSON string

    XMLWordPrintable

    Details

    • Type: Incident report
    • Status: Closed
    • Priority: Trivial
    • Resolution: Duplicate
    • Affects Version/s: 3.0.2
    • Fix Version/s: None
    • Component/s: Proxy (P), Server (S)
    • Labels:
    • Environment:
      CentOS 6.7

      Description

      Create a external check script to mimick a LLD with non-ascii characters 'çã', using 3 methods:

      1. UTF-8 encoded unicode: 0xc3 0xa7 0xc3 0xa3
      2. ISO-8859-1 encoded: 0xe7 0xe3
      3. JSON unicode escaped: "\u00e7\u00e3"

      This can be achieved with the following code:
      test.sh:

      #!/bin/bash
      echo '{"data":[{"{#IFNAME}":"çã"},{"{#IFNAME}":"'"$(echo 'çã' | iconv -t iso88591)"'"},{"{#IFNAME}":"\u00e7\u00e3"}]}'
      

      Note that the script assumes your environment to be UTF-8.

      Now create a LLD rule and use the external script as key (check xml host example). Zabbix will do the following:

      1. UTF-8 byte sequence will be interpreted as ISO-8859-1 and get doubly encoded to 0xc3 0x83 0xc2 0xa7 0xc3 0x83 0xc2 0xa3 (çã)
      2. ISO-8859-1 bytes will be replaced with '?' by function 'zbx_replace_invalid_utf8' in 'src/libs/zbxcommon/str.c'.
      3. Non-control characters escaped in JSON notation will cause the LLD rule to fail (because function 'zbx_json_decode_character' in 'src/libs/zbxjson/json.c' does not support such characters).

      Please check the screenshots.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              fernandosch Fernando Schmitt
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: