G'day mldvx4,

Note: I've used this common alias of mine in a couple of places:

$ alias perlu alias perlu='perl -Mstrict -Mwarnings -Mautodie=:all -Mutf8 -C -E'

There are two lines in your output that you should note. When I run your code as posted, I get:

... <description>Feed from a to &#xC3;&#xB6;</description> ... <title>abc...&#xC3;&#xA5;&#xC3;&#xA4;&#xC3;&#xB6;</title> ...

When I add use utf8;, I get:

... <description>Feed from a to &#xF6;</description> ... <title>abc...&#xC3;&#xA5;&#xC3;&#xA4;&#xC3;&#xB6;</title> ...

So, that's fixed the $feed->description():

$ perlu 'say chr hex "F6"' ö

but not the $entry->title().

Look at the difference between how you code XML::Feed->new($format) and XML::Feed::Entry->new($format). Aligning those by changing

my $entry = XML::Feed::Entry->new();

to

my $entry = XML::Feed::Entry->new('RSS');

I now get:

... <description>Feed from a to &#xF6;</description> ... <title>abc...&#xE5;&#xE4;&#xF6;</title> ...

So, both the $feed->description() and $entry->title() are now fixed:

$ perlu 'say chr hex for qw{E5 E4 F6}' å ä ö

I'll also draw your attention to "XML::Feed: Atom feeds come out as bytes, but RSS as Unicode [rt.cpan.org #43004] #44". I haven't looked into this but it might have some relevance in relation to other XML::Feed work you may be doing.

— Ken


In reply to Re: UTF8 Output with XML::Feed? by kcott
in thread UTF8 Output with XML::Feed? by mldvx4

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.