2013년 2월 24일 일요일

Nagios NDO2DB: Unicode problem

I had encountered a problem related NDO2DB. I configured some of services' name  in Korean character. It shows well in Nagios web, but these services' name could't be recognized in Mysql tables which Ndo2db saves into becuase Ndo2db  add-on processes data without considering uni-code data. It was not solved even though I changed character set to UTF-8 in the tables.     

One of possible way to deal with is to change convert column which have to show by UTF8 in SQL query. 

The solutions is as following: 
CONVERT(CAST(column_name) as BINARY) USING UTF8) 
"This is a similar approach to our SELECT CONVERT(CAST(city as BINARY) USING utf8) trick above, where we basically hide the column’s actual data from MySQL by masking it as BINARY temporarily. 
If you simply force the column to UTF-8 without the BINARY conversion, MySQL does a data-changing conversion of your “latin1″ characters into “UTF-8″ and you end up with improperly converted data. Converting the column to BINARY first forces MySQL to not realize the data was in UTF-8 in the first place."
I referenced this from this site: http://nicj.net/mysql-converting-an-incorrect-latin1-column-to-utf8/


댓글 없음:

댓글 쓰기