Hello, I am trying to work with a XML document and having some encoding-type issues with it. First, this is the first few bytes of the XML document passed through "od -c":
0000000 377 376 < \0 ? \0 x \0 m \0 l \0 \0 v \ +0 0000020 e \0 r \0 s \0 i \0 o \0 n \0 = \0 " \ +0 0000040 1 \0 . \0 0 \0 " \0 \0 e \0 n \0 c \ +0 0000060 o \0 d \0 i \0 n \0 g \0 = \0 " \0 u \ +0 0000100 t \0 f \0 - \0 1 \0 6 \0 " \0 ? \0 > \ +0 0000120 \r \0 \n \0 < \0 l \0 i \0 s \0 t \0 i \ +0 0000140 n \0 g \0 _ \0 f \0 e \0 e \0 d \0 > \ +0 0000160 \r \0 \n
Of relevance here, I suppose, is that it is encoding="utf-16", which appears to me the XML document is correctly formed, although I am certainly no expert in this area. In plain ASCII, this would look something like:
<?xml version="1.0" encoding="utf-16"?> <listing_feed>
Now, I'm trying to do a regular expression match on this string, like so:
if($string =~ m/xml/) { ... }
.. but this does not work... However, this does:
if($string =~ m/x.m.l./) { ... }
Have I completely misunderstood that this type of regular expression match should work? I've tried using the "Encode" module to re-code this to UTF-8, or even ASCII but nothing I do can make this work.

.. I think I must be missing something obvious here...

- dEvNuL

In reply to Encoding question by devnul

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.