OpenDocument: Nicht-ASCII-Zeichen in styles.xml in UTF-8 konvertieren
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 7 Nov 2012 16:18:08 +0000 (17:18 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 7 Nov 2012 16:18:08 +0000 (17:18 +0100)
Fixt #1861.

SL/Template/OpenDocument.pm

index 12a7bc8..b4ea1f2 100644 (file)
@@ -270,14 +270,14 @@ sub parse {
 
   $zip->contents("content.xml", Encode::encode('utf-8-strict', $new_contents));
 
-  my $styles = $zip->contents("styles.xml");
+  my $styles = Encode::decode('utf-8-strict', $zip->contents("styles.xml"));
   if ($contents) {
     my $new_styles = $self->parse_block($styles);
     if (!defined($new_contents)) {
       $main::lxdebug->leave_sub();
       return 0;
     }
-    $zip->contents("styles.xml", $new_styles);
+    $zip->contents("styles.xml", Encode::encode('utf-8-strict', $new_styles));
   }
 
   $zip->writeToFileNamed($form->{"tmpfile"}, 1);