Hello,
While using utf-8 as default encoding I encountered a bug. MIME::Base64
functions do not want to handle wide characters gracefully which caused
run-time errors (wide character... squeek-squeek in encode_base64).
The bug showed up when I tried to log-in into my fresh created agent acc.
because my surname contains iso-8859-2 characters which were encoded in
utf8 and stored in database as such.
mysql> select id, login, first_name, last_name from system_user;
+----+----------------+------------+-----------+
| id | login | first_name | last_name |
+----+----------------+------------+-----------+
| 1 | [EMAIL PROTECTED] | Admin | OTRS |
| 2 | ddzeko | Damir | D<C5><BE>eko |
+----+----------------+------------+-----------+
I managed to correct that by adding three lines of code where neeeded.
The patch works for me though it's not the best possible solution. Good
thing is that it did not break anything else, as far as I tested it
(creating new user with 8-bit characters in name).
I presume that it will work only with perls >= 5.8.
Here it is:
--- orig-1.3.2-01/Kernel/System/AuthSession/IPC.pm 2004-05-03
10:48:05.000000000 +0200
+++ Kernel/System/AuthSession/IPC.pm 2004-11-23 12:15:05.000000000 +0100
@@ -217,6 +217,7 @@
foreach (@PaarData) {
my ($Key, $Value) = split(/:/, $_);
$Data{$Key} = decode_base64($Value);
+ utf8::decode($Data{$Key}) if ($Data{$Key} =~
/[\xC0-\xCF][\x80-\xFF]/);
}
# Debug
if ($Self->{Debug}) {
@@ -249,6 +250,7 @@
my $DataToStore = "SessionID:". encode_base64($SessionID, '') .";";
foreach (keys %Param) {
if (defined($Param{$_})) {
+ utf8::encode($Param{$_}) if ($Param{$_} =~ /[\x{0100}-\x{EFFF}]/);
$Param{$_} = encode_base64($Param{$_}, '');
$DataToStore .= "$_:". $Param{$_} .";";
}
@@ -317,6 +319,7 @@
# set new data sting
my $NewDataToStore = "SessionID:". encode_base64($SessionID, '').";";
foreach (keys %SessionData) {
+ utf8::encode($SessionData{$_}) if ($SessionData{$_} =~
/[\x{0100}-\x{EFFF}]/);
$SessionData{$_} = encode_base64($SessionData{$_}, '');
$NewDataToStore .= "$_:$SessionData{$_};";
chomp ($SessionData{$_});
_______________________________________________
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
Support oder Consulting für Ihr OTRS System?
=> http://www.otrs.de/