Hello everyone,
I've found an encoding problem inside this extension. Whenever it
receives user information from database, special characters like German
umlauts are not UTF-8 encoded. This causes that each field which
contains special characters will be updated.
After the update there is no encoding problem because the data from LDAP
is encoded in UTF-8, but there is a huge database pollution in the
transaction table. My LDAP synchronization includes ~ 2000 users, most
of them are located in "Düsseldorf" (field "City"), cron job runs every
15 minutes---imagine how many inserts have been made in the last few
weeks ;-)
Here is what
/opt/rt4/local/plugins/RT-Extension-LDAPImport/bin/rtldapimport --debug
wrote:
City D�sseldorf => Düsseldorf
I couldn't resolv the problem within the extension. So I patched
/opt/rt4/lib/RT/Record.pm (see my attachment). This works, but looks
like an ugly workaround.
More information about my system:
* RT 4.0.2
* Perl 5.10.1
* Linux debian 2.6.32-5-686 #1 SMP Fri Sep 9 20:51:05 UTC 2011 i686
GNU/Linux
Thank you very much for you help!
Benjamin Heisig
Subject: | Record.pm.patch |
--- a/Record.pm 2012-01-19 09:53:56.802582265 +0100
+++ b/Record.pm 2012-01-19 10:00:38.203170994 +0100
@@ -887,10 +887,14 @@
my $name = $self->$object->Name;
next if $name eq $value || $name eq ($value || 0);
};
- next if $value eq $self->$attribute();
- next if ($value || 0) eq $self->$attribute();
- };
+ my $existing = $self->$attribute();
+ my $current = Encode::encode("utf8", $existing);
+
+ next if Encode::encode("utf8", $value) eq $current;
+ next if ($value || 0) eq $current;
+ };
+
$new_values{$attribute} = $value;
}