From abbd99fdbe691f0bfc84aac2e76a2296ab808d6a Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 26 Jun 2008 09:55:38 +0000 Subject: [PATCH] =?utf8?q?Fixes=20f=C3=BCr=20die=20Situation,=20in=20der?= =?utf8?q?=20$dbcharset=20anders=20ist=20als=20das=20Charset=20der=20f?= =?utf8?q?=C3=BCr=20den=20Benutzer=20ausgew=C3=A4hlten=20Sprache:=20Die=20?= =?utf8?q?Datei=20"special=5Fchars"=20in=20das=20$dbcharset=20konvertiert?= =?utf8?q?=20werden.=20Beim=20umgekehrten=20Aufl=C3=B6sen=20der=20durch=20?= =?utf8?q?Button-Dr=C3=BCcke=20ausgel=C3=B6sten=20Aktionen=20in=20Funktion?= =?utf8?q?snamen=20muss=20von=20$dbcharset,=20das=20vom=20Browser=20kommt,?= =?utf8?q?=20in=20das=20Charset=20der=20vom=20Benutzer=20ausgew=C3=A4hlten?= =?utf8?q?=20Sprache=20konvertiert=20werden,=20damit=20die=20Aufl=C3=B6sun?= =?utf8?q?g=20funktioniert.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Locale.pm | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/SL/Locale.pm b/SL/Locale.pm index 2b662bf17..0ddcf0451 100644 --- a/SL/Locale.pm +++ b/SL/Locale.pm @@ -85,13 +85,14 @@ sub _init { $self->{charset} = Common::DEFAULT_CHARSET; } - $self->_read_special_chars_file($country); - my $db_charset = $main::dbcharset || Common::DEFAULT_CHARSET; $self->{iconv} = Text::Iconv->new($self->{charset}, $db_charset); + $self->{iconv_reverse} = Text::Iconv->new($db_charset, $self->{charset}); $self->{iconv_english} = Text::Iconv->new('ASCII', $db_charset); $self->{iconv_iso8859} = Text::Iconv->new('ISO-8859-15', $db_charset); + + $self->_read_special_chars_file($country); } $self->{NLS_file} = $NLS_file; @@ -166,13 +167,13 @@ sub _read_special_chars_file { } my $scmap = $self->{special_chars_map}->{$format}; - my $order = $scmap->{order}; + my $order = $self->{iconv}->convert($scmap->{order}); delete $scmap->{order}; foreach my $key (keys %{ $scmap }) { - $scmap->{$key} = $self->_handle_markup($scmap->{$key}); + $scmap->{$key} = $self->_handle_markup($self->{iconv}->convert($scmap->{$key})); - my $new_key = $self->_handle_markup($key); + my $new_key = $self->_handle_markup($self->{iconv}->convert($key)); if ($key ne $new_key) { $scmap->{$new_key} = $scmap->{$key}; @@ -208,14 +209,12 @@ sub findsub { $main::lxdebug->enter_sub(); my ($self, $text) = @_; + my $text_rev = $self->{iconv_reverse}->convert($text); - if (exists $self->{subs}{$text}) { - $text = $self->{subs}{$text}; - } else { - if ($self->{countrycode} && $self->{NLS_file}) { - Form->error( - "$text not defined in locale/$self->{countrycode}/$self->{NLS_file}"); - } + if (exists $self->{subs}{$text_rev}) { + $text = $self->{subs}{$text_rev}; + } elsif ($self->{countrycode} && $self->{NLS_file}) { + Form->error("$text not defined in locale/$self->{countrycode}/$self->{NLS_file}"); } $main::lxdebug->leave_sub(); -- 2.20.1