1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#! /bin/sh /usr/share/dpatch/dpatch-run
## file_consumer_encoding.dpatch by Florian Ragwitz <rafl@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Add '>:encoding(EncodeTo)' line discipline to FileConsumer to defeat
## DP: perl's automatic charset conversion.
@DPATCH@
--- libxml-sax-writer-perl-0.44.orig/Writer.pm 2006-06-15 18:37:59.691339952 +0200
+++ libxml-sax-writer-perl-0.44/Writer.pm 2006-06-15 18:41:40.715739136 +0200
@@ -316,7 +316,10 @@
# new
#-------------------------------------------------------------------#
sub new {
- my ( $proto, $file ) = ( shift, shift );
+ my ( $proto, $file, $opt ) = @_;
+ my $enc_to = (defined $opt and ref $opt eq 'HASH'
+ and defined $opt->{EncodeTo}) ? $opt->{EncodeTo}
+ : 'utf-8';
XML::SAX::Writer::Exception->throw(
Message => "No filename provided to " . ref( $proto || $proto )
@@ -324,9 +327,10 @@
local *XFH;
- open XFH, ">$file" or XML::SAX::Writer::Exception->throw(
+ open XFH, ">:encoding($enc_to)", $file
+ or XML::SAX::Writer::Exception->throw(
Message => "Error opening file $file: $!"
- );
+ );
return $proto->SUPER::new( *{XFH}{IO}, @_ );
}
|