in reply to Re^4: UTF8 Output with XML::Feed? (updated)
in thread UTF8 Output with XML::Feed?

erm ... едц???

I had the same thought on my first reading of that post, and even send a /msg to that effect.

But then I reread kcott's post, and saw that the second block of code from the earlier post was the code kcott focused on, and was presumably the code that kcott said didn't need use utf8; -- which seems right, because it doesn't contain non-ASCII characters.

Replies are listed 'Best First'.
Re^6: UTF8 Output with XML::Feed? (updated)
by LanX (Saint) on Mar 07, 2022 at 20:46 UTC
    yes I realized it in the meantime.

    I didn't expect it but \N{} is automatically activating the utf8 flag for the surrounding string. (which makes sense in hindsight)

    use v5.12; use warnings; use Devel::Peek; #use open OUT => qw{:encoding(UTF-8) :std}; my $t4 = "\N{LATIN SMALL LETTER A WITH RING ABOVE}\n"; Dump $t4; warn "t4: ",$t4; __DATA__
    OUTPUT:
    SV = PV(0xe7ae08) at 0xd308f0 REFCNT = 1 FLAGS = (POK,IsCOW,pPOK,UTF8) PV = 0x2742188 "\303\245\n"\0 [UTF8 "\x{e5}\n"] CUR = 3 LEN = 10 COW_REFCNT = 1 t4: е

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery