From: Moritz Bunkus Date: Thu, 3 May 2007 14:13:14 +0000 (+0000) Subject: Änderungen zur Unterstützung von anderen Zeichensätzen als ISO-8859-1(5) implementier... X-Git-Tag: release-2.4.3^2~402 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=faef45c2e723c9fbc80d1d84b8481367204719b7;p=kivitendo-erp.git Änderungen zur Unterstützung von anderen Zeichensätzen als ISO-8859-1(5) implementiert. Es ist jetzt möglich, $dbcharset in lx-erp.conf auf UTF-8 zu setzen und dann auch UTF-8 als Datenbankencoding zu benutzen. --- 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|