This works for me.

D:\>file Simple.xml Simple.xml: Text file, UTF-8 format D:\>cat Simple.xml <?xml version="1.0" encoding="UTF-8"?> <root> <foo> bar </foo> </root> D:\>od -h Simple.xml | head -1 | cut -c 1-24 0000000000 EF BB BF D:\>cat Simple.pl #!perl use strict; use warnings; use XML::Simple; local $XML::Simple::PREFERRED_PARSER = 'XML::Parser'; my $file = shift @ARGV; my $xml = XMLin($file, ForceArray => ['map'], KeyAttr => {}); D:\>perl Simple.pl Simple.xml D:\>perl -v | head -8 | fmt -w 68 This is perl 5, version 12, subversion 2 (v5.12.2) built for MSWin32-x86-multi-thread (with 8 registered patches, see perl -V for more detail) Copyright 1987-2010, Larry Wall Binary build 1202 [293621] provided by ActiveState http://www.ActiveState.com Built Sep 6 2010 23:36:03 D:\>

Simple.xml is a simple XML document in the UTF-8 character encoding scheme of the Unicode coded character set. It has a UTF-8 byte order mark in it. XML::Simple handles the XML document properly.


In reply to Re: Encode throws "Wide character in subroutine entry" when using XML::Simple by Jim
in thread Encode throws "Wide character in subroutine entry" when using XML::Simple by nglenn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.