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.
- duplicates
-
ZBX-10540 Japanese characters are changed to ?????? in "Trigger Description" have been created by the discovery
- Closed