X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/d232a24687ea63a0f57723b7730d82f12241cec9..dfb76ebf04df9aed8ba63d7b51bc558d2928030e:/SL/Template/LaTeX.pm diff --git a/SL/Template/LaTeX.pm b/SL/Template/LaTeX.pm index c66399fc4..2df7e8cfb 100644 --- a/SL/Template/LaTeX.pm +++ b/SL/Template/LaTeX.pm @@ -5,6 +5,7 @@ use parent qw(SL::Template::Simple); use strict; use Cwd; +use Unicode::Normalize qw(); sub new { my $type = shift; @@ -353,8 +354,13 @@ sub parse { return 0; } - binmode OUT, ":utf8" if $::locale->is_utf8; - print(OUT $new_contents); + if ($::locale->is_utf8) { + binmode OUT, ":utf8"; + print OUT Unicode::Normalize::normalize('C', $new_contents); + + } else { + print OUT $new_contents; + } if ($form->{"format"} =~ /postscript/i) { return $self->convert_to_postscript(); @@ -381,13 +387,16 @@ sub convert_to_postscript { my $latex = $self->_get_latex_path(); my $old_home = $ENV{HOME}; - $ENV{HOME} = $userspath =~ m|^/| ? $userspath : getcwd() . "/" . $userspath; + my $old_openin_any = $ENV{openin_any}; + $ENV{HOME} = $userspath =~ m|^/| ? $userspath : getcwd(); + $ENV{openin_any} = "p"; for (my $run = 1; $run <= 2; $run++) { system("${latex} --interaction=nonstopmode $form->{tmpfile} " . "> $form->{tmpfile}.err"); if ($?) { $ENV{HOME} = $old_home; + $ENV{openin_any} = $old_openin_any; $self->{"error"} = $form->cleanup($latex); return 0; } @@ -397,6 +406,7 @@ sub convert_to_postscript { system("dvips $form->{tmpfile} -o -q > /dev/null"); $ENV{HOME} = $old_home; + $ENV{openin_any} = $old_openin_any; if ($?) { $self->{"error"} = "dvips : $!"; @@ -426,19 +436,23 @@ sub convert_to_pdf { my $latex = $self->_get_latex_path(); my $old_home = $ENV{HOME}; - $ENV{HOME} = $userspath =~ m|^/| ? $userspath : getcwd() . "/" . $userspath; + my $old_openin_any = $ENV{openin_any}; + $ENV{HOME} = $userspath =~ m|^/| ? $userspath : getcwd(); + $ENV{openin_any} = "p"; for (my $run = 1; $run <= 2; $run++) { system("${latex} --interaction=nonstopmode $form->{tmpfile} " . "> $form->{tmpfile}.err"); if ($?) { $ENV{HOME} = $old_home; + $ENV{openin_any} = $old_openin_any; $self->{error} = $form->cleanup($latex); return 0; } } $ENV{HOME} = $old_home; + $ENV{openin_any} = $old_openin_any; $form->{tmpfile} =~ s/tex$/pdf/; $self->cleanup();