API return unreadable characters.

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
dimsum
Posts: 153
Joined: Thu Aug 15, 2013 6:05 pm

API return unreadable characters.

Post by dimsum »

Hi,

I have used an API but I got an unreadable string.
"host_name": "\u0e41\u0e21\u0e48\u0e2e\u0e48\u0e2d\u0e07\u0e2a\u0e2d\u0e19_\u0e1b\u0e32\u0e07\u0e21\u0e30\u0e1c\u0e49\u0e32"
My host_name is Thai characters. Can I get the Thai characters?

Thank you.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: API return unreadable characters.

Post by lmiltchev »

This is exactly what you would see in a browser, under the "Raw Data" tab. The browser takes care of the conversion to Thai characters (under the JSON tab), and makes it "pretty". There is probably a way to do the same when you run the curl command from the CLI, but you would have to use some kind of script to convert the characters to utf-8. I tried using "iconv" from the CLI, but I was not able to make it work. Perhaps the conversion could be achieved via a php script. We will have to do some more digging into this.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked