Page 1 of 1

Error: (0) json_encode(): Invalid UTF-8 sequence in argument

Posted: Fri Jul 10, 2020 7:08 am
by katronic
Hello,
The following problem appeared after upgrading to Nagios 5.7.1. After entering Nagvis, on some maps I get the following error message:

Error: (0) json_encode(): Invalid UTF-8 sequence in argument
URL: /nagvis/server/core/ajax_handler.php?mod=Map&act=getMapObjects&show=Mapa1&header_menu=1&hover_menu=1&context_menu=1&zoombar=1&zoom=100&_ajaxid=1594381825
File: /usr/local/nagvis/share/server/core/classes/NagVisMap.php
Line: 116
#0 [internal function]: nagvisExceptionErrorHandler(2, 'json_encode(): ...', '/usr/local/nagv...', 116, Array)
#1 /usr/local/nagvis/share/server/core/classes/NagVisMap.php(116): json_encode(Array)
#2 /usr/local/nagvis/share/server/core/classes/CoreModMap.php(322): NagVisMap->parseObjectsJson()
#3 /usr/local/nagvis/share/server/core/classes/CoreModMap.php(105): CoreModMap->getMapObjects()
#4 /usr/local/nagvis/share/server/core/functions/index.php(120): CoreModMap->handleAction()
#5 /usr/local/nagvis/share/server/core/ajax_handler.php(59): require('/usr/local/nagv...')
#6 {main}

result of the "locale" command:

LANG=pl_PL.UTF-8
LC_CTYPE="pl_PL.UTF-8"
LC_NUMERIC="pl_PL.UTF-8"
LC_TIME="pl_PL.UTF-8"
LC_COLLATE="pl_PL.UTF-8"
LC_MONETARY="pl_PL.UTF-8"
LC_MESSAGES="pl_PL.UTF-8"
LC_PAPER="pl_PL.UTF-8"
LC_NAME="pl_PL.UTF-8"
LC_ADDRESS="pl_PL.UTF-8"
LC_TELEPHONE="pl_PL.UTF-8"
LC_MEASUREMENT="pl_PL.UTF-8"
LC_IDENTIFICATION="pl_PL.UTF-8"
LC_ALL=

A request to help solve a problem...

Re: Error: (0) json_encode(): Invalid UTF-8 sequence in argu

Posted: Fri Jul 10, 2020 4:29 pm
by benjaminsmith
Hi Katronic,

After researching the error, I found a similar support case that was resolved by the following change. Edit your /etc/my.cnf and under the [mysqld] section add this line:

Code: Select all

init-connect='SET NAMES utf8'
Then restart the services:

Code: Select all

systemctl stop nagios
systemctl restart mariadb
systemctl start nagios
And let me know if the problem is resolved. If not, revert the changes and send use your system profile. Thanks, Benjamin

To send us your system profile.
Login to the Nagios XI GUI using a web browser.
Click the "Admin" > "System Profile" Menu
Click the "Download Profile" button
Save the profile.zip file and share in a private message or upload it to the post/ticket, and then reply to this post to bring it up in the queue.

Re: Error: (0) json_encode(): Invalid UTF-8 sequence in argu

Posted: Mon Jul 13, 2020 2:20 am
by katronic
Hi,
I confirm that the problem has been resolved :)
Thank you very much for your help!

Re: Error: (0) json_encode(): Invalid UTF-8 sequence in argu

Posted: Mon Jul 13, 2020 2:13 pm
by lmiltchev
I am glad your issue has been resolved! I am closing this thread. Thank you!