From faef45c2e723c9fbc80d1d84b8481367204719b7 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 3 May 2007 14:13:14 +0000 Subject: [PATCH] =?utf8?q?=C3=84nderungen=20zur=20Unterst=C3=BCtzung=20von?= =?utf8?q?=20anderen=20Zeichens=C3=A4tzen=20als=20ISO-8859-1(5)=20implemen?= =?utf8?q?tiert.=20Es=20ist=20jetzt=20m=C3=B6glich,=20$dbcharset=20in=20lx?= =?utf8?q?-erp.conf=20auf=20UTF-8=20zu=20setzen=20und=20dann=20auch=20UTF-?= =?utf8?q?8=20als=20Datenbankencoding=20zu=20benutzen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Common.pm | 20 +++++++ SL/DBUpgrade2.pm | 4 ++ SL/Form.pm | 17 +++--- SL/Locale.pm | 24 +++++++- SL/Mailer.pm | 4 +- SL/User.pm | 86 ++++++++++++++++++++++------ bin/mozilla/admin.pl | 47 +++++++-------- bin/mozilla/login.pl | 2 +- locale/de/admin | 13 ++++- locale/de/all | 1 - locale/de/am | 12 ++++ locale/de/ap | 11 ++++ locale/de/ar | 11 ++++ locale/de/arap | 12 ++++ locale/de/bp | 10 ++++ locale/de/charset | 1 + locale/de/common | 12 ++++ locale/de/cp | 11 ++++ locale/de/ct | 10 ++++ locale/de/datev | 12 ++++ locale/de/drafts | 12 ++++ locale/de/gl | 12 ++++ locale/de/licenses | 12 ++++ locale/de/login | 12 ++++ locale/de/pe | 12 ++++ locale/de/rc | 12 ++++ locale/de/rp | 11 ++++ locale/de/ustva | 12 ++++ sql/Pg-upgrade2/USTVA_abstraction.pl | 4 +- 29 files changed, 363 insertions(+), 56 deletions(-) create mode 100644 locale/de/charset diff --git a/SL/Common.pm b/SL/Common.pm index 826581e74..73be248ce 100644 --- a/SL/Common.pm +++ b/SL/Common.pm @@ -10,6 +10,26 @@ package Common; use Time::HiRes qw(gettimeofday); +use vars qw(@db_encodings %db_encoding_to_charset); + +@db_encodings = ( + { "label" => "ASCII", "dbencoding" => "SQL_ASCII", "charset" => "ASCII" }, + { "label" => "UTF-8 Unicode", "dbencoding" => "UNICODE", "charset" => "UTF-8" }, + { "label" => "ISO 8859-1", "dbencoding" => "LATIN1", "charset" => "ISO-8859-1" }, + { "label" => "ISO 8859-2", "dbencoding" => "LATIN2", "charset" => "ISO-8859-2" }, + { "label" => "ISO 8859-3", "dbencoding" => "LATIN3", "charset" => "ISO-8859-3" }, + { "label" => "ISO 8859-4", "dbencoding" => "LATIN4", "charset" => "ISO-8859-4" }, + { "label" => "ISO 8859-5", "dbencoding" => "LATIN5", "charset" => "ISO-8859-5" }, + { "label" => "ISO 8859-15", "dbencoding" => "LATIN9", "charset" => "ISO-8859-15" }, + { "label" => "KOI8-R", "dbencoding" => "KOI8", "charset" => "KOI8-R" }, + { "label" => "Windows CP1251", "dbencoding" => "WIN", "charset" => "CP1251" }, + { "label" => "Windows CP866", "dbencoding" => "ALT", "charset" => "CP866" }, +); + +%db_encoding_to_charset = map { $_->{dbencoding}, $_->{charset} } @db_encodings; + +use constant DEFAULT_CHARSET => 'ISO-8859-15'; + sub unique_id { my ($a, $b) = gettimeofday(); return "${a}-${b}-${$}"; diff --git a/SL/DBUpgrade2.pm b/SL/DBUpgrade2.pm index 8cde113ea..66ce85f9c 100644 --- a/SL/DBUpgrade2.pm +++ b/SL/DBUpgrade2.pm @@ -1,5 +1,7 @@ package SL::DBUpgrade2; +use SL::Common; + require Exporter; @ISA = qw(Exporter); @@ -45,6 +47,8 @@ sub parse_dbupdate_controls { } } + $control->{charset} ||= Common::DEFAULT_CHARSET; + _control_error($form, $file_name, $locale->text("Missing 'tag' field.")) unless ($control->{"tag"}); diff --git a/SL/Form.pm b/SL/Form.pm index 61e5f68fa..d59adeece 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -45,6 +45,7 @@ use CGI::Ajax; use SL::DBUtils; use SL::Menu; use SL::User; +use SL::Common; use CGI; sub _input_to_hash { @@ -352,7 +353,7 @@ sub header { return; } - my ($stylesheet, $favicon, $charset); + my ($stylesheet, $favicon); if ($ENV{HTTP_USER_AGENT}) { @@ -370,11 +371,8 @@ sub header { |; } - if ($self->{charset}) { - $charset = - qq| - |; - } + my $db_charset = $main::dbcharset ? $main::dbcharset : Common::DEFAULT_CHARSET; + if ($self->{landscape}) { $pagelayout = qq|