From 3bde3a2889c30abd19e4f48fb4126b713faf75b7 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 10 Oct 2011 15:12:29 +0200 Subject: [PATCH] UTF-8-Daten vor Ausgabe an Template auf Form C normalisieren Wenn UTF-8-Daten als Form D vorliegen, so steigt LaTeX aus, weil es diese Form nicht kennt. --- SL/Template/LaTeX.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/SL/Template/LaTeX.pm b/SL/Template/LaTeX.pm index c66399fc4..c7d51e0e0 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(); -- 2.20.1