From e9cfbf41600bb0bf370b0654587f44723282cf08 Mon Sep 17 00:00:00 2001 From: jsatoh Date: Mon, 4 Apr 2011 04:59:37 +0000 Subject: [PATCH] 2011-04-04 Junichi Satoh * lib/PandoraFMS/Tools.pm: Added UTF-8 flags deletion from multibyte characters when files are opened. * lib/PandoraFMS/DB.pm: Added mysql_enable_utf8. It enables character semantics (support for multibyte characters). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4161 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 8 ++++++++ pandora_server/lib/PandoraFMS/DB.pm | 2 +- pandora_server/lib/PandoraFMS/Tools.pm | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 7fe070b5ae..5f548fd9b5 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,11 @@ +2011-04-04 Junichi Satoh + + * lib/PandoraFMS/Tools.pm: Added UTF-8 flags deletion from multibyte + characters when files are opened. + + * lib/PandoraFMS/DB.pm: Added mysql_enable_utf8. It enables character + semantics (support for multibyte characters). + 2011-03-16 Dario Rodriguez * util/plugin/create_integria_incident.sh: Fixed an error in help text. diff --git a/pandora_server/lib/PandoraFMS/DB.pm b/pandora_server/lib/PandoraFMS/DB.pm index 90ccfc22ff..f2f6ce1261 100644 --- a/pandora_server/lib/PandoraFMS/DB.pm +++ b/pandora_server/lib/PandoraFMS/DB.pm @@ -66,7 +66,7 @@ sub db_connect ($$$$$$) { if ($rdbms eq 'mysql') { # Connect to MySQL - my $dbh = DBI->connect("DBI:mysql:$db_name:$db_host:3306", $db_user, $db_pass, { RaiseError => 1, AutoCommit => 1 }); + my $dbh = DBI->connect("DBI:mysql:$db_name:$db_host:3306", $db_user, $db_pass, { RaiseError => 1, AutoCommit => 1, mysql_enable_utf8 => 1 }); return undef unless defined ($dbh); # Enable auto reconnect diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index 9abfba2a73..61f2c9adb4 100644 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -30,6 +30,10 @@ use HTML::Entities; # Used to calculate the MD5 checksum of a string use constant MOD232 => 2**32; +# UTF-8 flags deletion from multibyte characters when files are opened. +use open OUT => ":utf8"; +use open ":std"; + require Exporter; our @ISA = ("Exporter");