Perl can quite happily deal with binary strings of bytes. If putting CP1252 data into binary strings makes your job easier then fine do that - I'm certainly not suggesting that would be 'wrong'. But XML is not a binary format. XML is for strings of character data. Perl's native format for character data is UTF-8. If you want to use Perl's character functions like lc, uc, length, substr, tr, regular expressions etc then your data needs to be in UTF-8. ASCII data is a subset of UTF-8 so characters in the 0x00-0x7F range already are UTF-8. But for characters from 0x80 and beyond your data must be UTF-8 for Perl's character functions to understand them. Other languages use different native encodings - Java for instance uses UTF-16.
Remember that an XML document which uses the CP1252 encoding can also contain characters which are not CP1252. For example if the document contained the numeric character entity Ā (a capital A with a macron: Ā) then the Perl string returned from XML::Simple will contain that character. Similarly if the document used a DTD which defined named character entities (such as α) then those will also be translated into the appropriate characters.
You ask why XML::Simple doesn't support legacy encodings and yet it demonstrably does. When you read an XML file in a legacy encoding the parser module used by XML::Simple transparently converts the data from the specified legacy encoding into Perl's native character encoding. Note this is a function of all the parser modules (eg: SAX, XML::Parser, LibXML etc) and not actually a function of XML::Simple which is just a convenience layer over the parser modules. XML::Simple doesn't transparently support converting to another encoding when generating XML because I have never needed that functionality. You could probably implement it for the CP1252 case by overriding XML::Simple's escape_value method.
Finally, you make the silly assertion that as the author of XML::Simple I am demanding you rewrite your legacy code to use unicode in order to use XML::Simple. I am not demanding anything. I am providing a tool which you may or may not find useful. If it is not useful to you then of course you should use a different tool.
(10)
]
