Nagios Bug and Feature Tracker
Bug and Feature Tracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000170 [Nagios Core] Web Interface tweak always 2010-10-24 14:24 2013-12-02 08:31
Reporter dvoryanchikov View Status public  
Assigned To ageric
Priority normal Resolution fixed  
Status closed   Product Version
Summary 0000170: Object values in utf8 are displayed incorrectly in the web interface
Description I have some contact aliases, hostnames and service descriptions defined in utf8.

Because of its names get encoded I can't see it or submit any commands with it.

For example, I have host named "дверь" and in web interface it displays as "дверÑ" ("дверÑ" in page source).

I've found solution at mailing lists and made a patch wich allows me to use utf8 values valuably.

Best regards,
Alexey Dvoryanchikov.
Additional Information --- cgi/cgiutils.c~ 2010-10-04 07:17:09.000000000 +0400
+++ cgi/cgiutils.c 2010-10-24 22:19:06.588886823 +0400
@@ -1392,6 +1392,12 @@
             y++;
                 }
 
+ /* high bit characters don't get encoded */
+ else if((unsigned char)input[x]>=0x7f){
+ str[y]=input[x];
+ y++;
+ }
+
         /* spaces are pluses */
         else if((char)input[x]<=(char)' '){
             str[y]='+';
@@ -1556,6 +1562,10 @@
         else if(((char)input[x]==(char)' ') || ((char)input[x]==(char)'-') || ((char)input[x]==(char)'.') || ((char)input[x]==(char)'_') || ((char)input[x]==(char)':'))
             encoded_html_string[y++]=input[x];
 
+ /* high bit characters don't get encoded */
+ else if((unsigned char)input[x]>=0x7f)
+ encoded_html_string[y++]=input[x];
+
         /* for simplicity, all other chars represented by their numeric value */
         else{
             encoded_html_string[y]='\x0';
Tags No tags attached.
Nagios Version 3.2.3
OS any
OS Version any
Attached Files ? file icon nagios_utf8_cgi.patch [^] (985 bytes) 2010-10-24 14:24

- Relationships

-  Notes
(0000251)
dnsmichi (reporter)
2010-11-05 04:01

defining a test service shows the exact same behavior as described in the issue. applying the patch resolves the issue either in displaying the correct strings but also creating correct urls, not replacing so-called whitespace matches into '+'.

should be applied to upstream (needs identing though).
(0000256)
md (reporter)
2010-11-19 01:20
edited on: 2010-11-19 01:21

I've applied the patch. It's OK with status.cgi, now I can see Russian letters in host list. But in showlog.cgi (Event Log) is shown:

Кемерово-5

instead of

Кемерово-5

Nagios 3.2.3, FreeBSD 7.2

(0000257)
dvoryanchikov (reporter)
2010-11-20 18:08
edited on: 2010-11-20 18:13

md, in my showlog.cgi everything is ok about russian letters.
showlog.cgi uses html_encode function to display log entries.

U shoud use the same locale for user of nagios and web server

and please make sure u have escape_html_tags=0 in cgi.cfg

For example, try to use settings like mine

nagios@nagios:~$ grep LANG /etc/default/locale
LANG=ru_RU.UTF-8
nagios@nagios:~$ file var/nagios.log
var/nagios.log: UTF-8 Unicode English text, with very long lines, with CR, LF line terminators
nagios@nagios:~$ grep utf share/index.php
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
nagios@nagios:~$ cat /etc/apache2/conf.d/charset
AddDefaultCharset UTF-8


or try to apply one more patch:

--- cgi/cgiutils.c~ 2010-10-24 22:50:52.000000000 +0400
+++ cgi/cgiutils.c 2010-11-21 02:44:01.000000000 +0300
@@ -1449,6 +1449,12 @@
         else if(((char)input[x]==(char)' ') || ((char)input[x]>='0' && (char)input[x]<='9') || ((char)input[x]>='A' && (char)input[x]<='Z') || ((char)input[x]>=(char)'a' && (char)input[x]<=(char)'z'))
             encoded_html_string[y++]=input[x];
 
+ /* high bit characters don't get encoded */
+ else if((unsigned char)input[x]>=0x7f){
+ encoded_html_string[y]=input[x];
+ y++;
+ }
+
         /* newlines turn to
tags */
         else if(escape_newlines==TRUE && (char)input[x]==(char)'\n'){
             strcpy(&encoded_html_string[y],"
");

Please, post your results here

(0000258)
md (reporter)
2010-11-21 12:42

Hello!
escape_html_tags=0 in cgi.cfg and AddDefaultCharset UTF-8 in apache configuration solved the problem. Thanks!

Проблема решена. Огромное спасибо за этот патч, очень не хватало его :).
(0000697)
dvoryanchikov (reporter)
2013-03-19 09:52

This patch seems to be useless since 3.5.0
(0000705)
ageric (reporter)
2013-03-23 12:39

Problem appears to be fixed, according to reporters, so resolving.
(0001036)
estanley (administrator)
2013-12-02 08:31

Released in Nagios Core 3.5.0

- Issue History
Date Modified Username Field Change
2010-10-24 14:24 dvoryanchikov New Issue
2010-10-24 14:24 dvoryanchikov File Added: nagios_utf8_cgi.patch
2010-10-24 14:24 dvoryanchikov Nagios Version => 3.2.3
2010-10-24 14:24 dvoryanchikov OS => any
2010-10-24 14:24 dvoryanchikov OS Version => any
2010-11-05 04:01 dnsmichi Note Added: 0000251
2010-11-19 01:20 md Note Added: 0000256
2010-11-19 01:21 md Note Edited: 0000256
2010-11-19 01:21 md Note Edited: 0000256
2010-11-20 18:08 dvoryanchikov Note Added: 0000257
2010-11-20 18:13 dvoryanchikov Note Edited: 0000257
2010-11-21 12:42 md Note Added: 0000258
2013-03-19 09:52 dvoryanchikov Note Added: 0000697
2013-03-23 12:39 ageric Status new => assigned
2013-03-23 12:39 ageric Assigned To => ageric
2013-03-23 12:39 ageric Note Added: 0000705
2013-03-23 12:39 ageric Status assigned => resolved
2013-03-23 12:39 ageric Resolution open => fixed
2013-04-24 07:53 ironman Issue Monitored: ironman
2013-12-02 08:31 estanley Note Added: 0001036
2013-12-02 08:31 estanley Status resolved => closed


Mantis 1.1.7[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker