[Po4a-devel]Fix encoding attribute handling in Xml.pm

Francois Gouget fgouget@free.fr
Thu, 19 May 2005 12:09:09 +0200 (CEST)


  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

---1463809536-727359330-1116497349=:4743
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed


Wine's DobBook documentation is in SGML but I also tried the DocBook.pm 
module on it. The nice thing is that it translates the 'lang' attribute. 
The bad thing is that it does not handle including files using entities 
and this is extensively used in Wine's documentation :-(.

Anyway, during this test I added the XML prologue recommended by the 
DocBook documentation:

http://www.docbook.org/tdg/en/html/ch02.html#ch02-makexml

<?xml version='1.0'?>
<!DOCTYPE book PUBLIC "-//Norman Walsh//DTD DocBk XML V3.1.4//EN"
                          "http://nwalsh.com/docbook/xml/3.1.4/db3xml.dtd">

This caused the Xml.pm module to emit some 'Use of uninitialized value' 
warnings because the <?xml> tag did not specify the encoding. That was 
(or seemed) easy to fix so here's an hopefully correct patch:


Changelog:

  * po4a/lib/Locale/Po4a/Xml.pm

    Francois Gouget <fgouget@free.fr>
    Append the encoding attribute if it is not defined in the <?xml> tag.

-- 
Francois Gouget         fgouget@free.fr        http://fgouget.free.fr/
                             $live{free} || die "";
---1463809536-727359330-1116497349=:4743
Content-Type: TEXT/plain; charset=US-ASCII; name=po4a-xml.diff
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.62.0505191209090.4743@amboise.dolphin>
Content-Description: po4a-xml.diff
Content-Disposition: attachment; filename=po4a-xml.diff

SW5kZXg6IHBvNGEvbGliL0xvY2FsZS9QbzRhL1htbC5wbQ0KPT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PQ0KUkNTIGZpbGU6IC9jdnNyb290L3dpbmUvZG9jcy9w
bzRhL2xpYi9Mb2NhbGUvUG80YS9YbWwucG0sdg0KcmV0cmlldmluZyByZXZp
c2lvbiAxLjEuMS4xDQpkaWZmIC11IC1wIC1yMS4xLjEuMSBYbWwucG0NCi0t
LSBwbzRhL2xpYi9Mb2NhbGUvUG80YS9YbWwucG0JMTQgTWF5IDIwMDUgMTI6
Mzc6MzQgLTAwMDAJMS4xLjEuMQ0KKysrIHBvNGEvbGliL0xvY2FsZS9QbzRh
L1htbC5wbQkxOSBNYXkgMjAwNSAxMDowMDoxMSAtMDAwMA0KQEAgLTM5OSw3
ICszOTksMTQgQEAgc3ViIHRhZ190cmFuc194bWxoZWFkIHsNCiAJJHNlbGYt
PmRldGVjdGVkX2NoYXJzZXQoJGluX2NoYXJzZXQpOw0KIAlteSAkb3V0X2No
YXJzZXQ9JHNlbGYtPmdldF9vdXRfY2hhcnNldDsNCiANCi0JJHRhZyA9fiBz
LyRpbl9jaGFyc2V0LyRvdXRfY2hhcnNldC87DQorICAgICAgICBpZiAoZGVm
aW5lZCAkaW5fY2hhcnNldCkNCisgICAgICAgIHsNCisgICAgICAgICAgICAk
dGFnID1+IHMvJGluX2NoYXJzZXQvJG91dF9jaGFyc2V0LzsNCisgICAgICAg
IH0NCisgICAgICAgIGVsc2UNCisgICAgICAgIHsNCisgICAgICAgICAgICAk
dGFnLj0gIiBlbmNvZGluZz0nJG91dF9jaGFyc2V0JyI7DQorICAgICAgICB9
DQogDQogCXJldHVybiAkdGFnOw0KIH0NCg==

---1463809536-727359330-1116497349=:4743--