Subject: | long-time Debian patches |
Hi,
I'm attaching two patches which have been in the XML-SAX-Writer Debian package for at least six years, but for some reason were never forwarded upstream. Unfortunately, the original author of these patches is no longer around and what is known about why these patches were felt to be necessary is only inferred from the code. Please have a look at them and include or reject as you see fit.
Florian
Subject: | file_consumer_encoding.patch |
Subject: Defensive to encoding of output in FileConsumer
* Add '>:encoding(EncodeTo)' line discipline to FileConsumer to defeat
perl's automatic charset conversion.
Author: Florian Ragwitz <rafl@debian.org>
Reviewed-by: Nicholas Bamber <nicholas@periapt.co.uk>
Forwarded: no
Last-Update: 2010-08-22
--- a/lib/XML/SAX/Writer.pm
+++ b/lib/XML/SAX/Writer.pm
@@ -327,7 +327,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 )
@@ -335,9 +338,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}, @_ );
}
Subject: | quote_xml_version.patch |
Subject: use double quotes in xml declarations
Author: Florian Ragwitz <rafl@debian.org>
Reviewed-by: Nicholas Bamber <nicholas@periapt.co.uk>
Forwarded: no
Last-Update: 2010-08-22
--- a/lib/XML/SAX/Writer/XML.pm
+++ b/lib/XML/SAX/Writer/XML.pm
@@ -484,14 +484,14 @@
# also, there's order in the pseudo-attr
my $xd = '';
if ($data->{Version}) {
- $xd .= "<?xml version='$data->{Version}'";
+ $xd .= "<?xml version=\"$data->{Version}\"";
if ($data->{Encoding}) {
- $xd .= " encoding='$data->{Encoding}'";
+ $xd .= " encoding=\"$data->{Encoding}\"";
}
if ($data->{Standalone}) {
- $xd .= " standalone='$data->{Standalone}'";
+ $xd .= " standalone=\"$data->{Standalone}\"";
}
- $xd .= '?>';
+ $xd .= "?>\n";
}
#$xd = $self->{Encoder}->convert($xd); # this may blow up