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

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
katronic
Posts: 6
Joined: Tue Jul 24, 2018 3:06 am

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

Post 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...
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

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

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
katronic
Posts: 6
Joined: Tue Jul 24, 2018 3:06 am

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

Post by katronic »

Hi,
I confirm that the problem has been resolved :)
Thank you very much for your help!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

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

Post by lmiltchev »

I am glad your issue has been resolved! I am closing this thread. Thank you!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked