Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

[dev.icinga.com #8723] utf8 isn't displayed in COMMENT_DATA #1346

Closed
icinga-migration opened this issue Mar 12, 2015 · 7 comments
Closed

[dev.icinga.com #8723] utf8 isn't displayed in COMMENT_DATA #1346

icinga-migration opened this issue Mar 12, 2015 · 7 comments

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/8723

Created by mfrosch on 2015-03-12 15:08:48 +00:00

Assignee: (none)
Status: New
Target Version: Backlog
Last Update: 2015-05-18 12:18:16 +00:00 (in Redmine)

Icinga Version: 1.11.7
Icinga Web Version: 1.11.7
IDO Version: 1.11.7
OS Version: 1.11.7
DB Type: MySQL
DB Version: any
Browser Version: any

Hi!

I installed icinga-1.11.7 and enable idomod. Created a database icinga in UTF8 :

icinga_comments CREATE TABLE `icinga_comments` (
`comment_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`instance_id` bigint(20) unsigned DEFAULT '0',
`entry_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`entry_time_usec` int(11) DEFAULT '0',
`comment_type` smallint(6) DEFAULT '0',
`entry_type` smallint(6) DEFAULT '0',
`object_id` bigint(20) unsigned DEFAULT '0',
`comment_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`internal_comment_id` bigint(20) unsigned DEFAULT '0',
`author_name` varchar(64) DEFAULT '',
`comment_data` text,
`is_persistent` smallint(6) DEFAULT '0',
`comment_source` smallint(6) DEFAULT '0',
`expires` smallint(6) DEFAULT '0',
`expiration_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`endpoint_object_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`comment_id`),
UNIQUE KEY `instance_id` (`instance_id`,`object_id`,`comment_time`,`internal_comment_id`),
KEY `comments_i_id_idx` (`instance_id`)
) ENGINE=InnoDB AUTO_INCREMENT=666 DEFAULT CHARSET=utf8 COMMENT='Usercomments on Icinga objects'

Then I installed icinga-web-1.12.0 and I found that COMMENT_DATA (and COMMENT_AUTHOR_NAME too) aren't display in UTF8.

Request for example:
/icinga-web/modules/web/simpleDataProvider/json?src_id=comments&filter

{result Admin",COMMENT_TIME 11:27:18",COMMENT_DATA "},{COMMENT_AUTHOR_NAME 14:22:09",COMMENT_DATA???"}
...skip...

I enable sql log and see:
641 Query SET NAMES utf8
641 Query SET NAMES 'utf8'

Thats ok. Then I executed inquiry from mysql:
mysql> use icinga;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> set NAMES utf8;
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT * FROM icinga_comments WHERE comment_time='2014-08-13 11:27:18';

------------------------*------------------------------------~~-------------*---------------------~~---------------------------------------------------------------------------------------------~~--------------*-----------------------~~--------------------*-------------------+
| comment_id | instance_id | entry_time | entry_time_usec | comment_type | entry_type | object_id | comment_time | internal_comment_id | author_name | comment_data | is_persistent | comment_source | expires | expiration_time | endpoint_object_id |

------------------------*------------------------------------~~-------------*---------------------~~---------------------------------------------------------------------------------------------~~--------------*-----------------------~~--------------------*-------------------+
| 1 | 1 | 2014-11-20 18:11:52 | 923157 | 2 | 4 | 164 | 2014-08-13 11:27:18 | 16092 | Icinga Admin | ждем поставки памяти | 1 | 0 | 0 | 0000-00-00 00:00:00 | NULL |

------------------------*------------------------------------~~-------------*---------------------~~---------------------------------------------------------------------------------------------~~--------------*-----------------------~~--------------------*-------------------+
1 row in set (0.00 sec)

mysql>

comment_data in UTF8.

If icinga-web create the comment, it puts to database in UTF8 and I can read it from classic UI and console mysql. But I don't read my comment in icinga-web. I see only '???'


Relations:

@icinga-migration
Copy link
Author

Updated by mfrosch on 2015-03-12 15:08:49 +00:00

  • Copied From set to 7782

@icinga-migration
Copy link
Author

Updated by mfrosch on 2015-03-12 15:09:42 +00:00

This is a problem of the Icinga Core, which does not write the UTF-8 code into the database.

It also seems to happen with Icinga2... (tested with 2.2.4)

The data is written correctly into the status.dat and displayed in ClassicUI

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-03-12 16:55:56 +00:00

  • Subject changed from utf8 isn't displayed in COMMENT_DATA to DB IDO Schema support for utf8

That's a schema problem which is not easy to change nor fix. See #2389 for details.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-03-12 16:56:09 +00:00

  • Relates set to 2389

@icinga-migration
Copy link
Author

Updated by leo9641 on 2015-03-13 10:30:21 +00:00

Yes, but I configured mysql-server default encoding in utf-8:

character-set-server=utf8
collation-server=utf8_general_ci
init_connect='SET collation_connection = utf8_general_ci'
init-connect='SET NAMES utf8'
skip-character-set-client-handshake

And icinga_comments had correct string in database in this case. But icinga-web (php) don't show this comment.

lazyfrosch wrote:

This is a problem of the Icinga Core, which does not write the UTF-8 code into the database.

It also seems to happen with Icinga2... (tested with 2.2.4)

The data is written correctly into the status.dat and displayed in ClassicUI

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-03-13 12:21:24 +00:00

  • Project changed from Icinga 2 to Web
  • Subject changed from DB IDO Schema support for utf8 to utf8 isn't displayed in COMMENT_DATA
  • Category set to Database & Queries
  • Icinga Web Version set to 1
  • IDO Version set to 1
  • OS Version set to 1
  • DB Type set to MySQL
  • DB Version set to any
  • Browser Version set to any

Ok. Then I'll move it back to Icinga Web 1.x

@icinga-migration
Copy link
Author

Updated by berk on 2015-05-18 12:18:16 +00:00

  • Target Version set to Backlog

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants