erm ... åäö???
> Do not use this pragma for anything else than telling Perl that your script is written in UTF-8.
Unfortunately this line is easily misunderstood. I recently had a long dispute with a camel award winner who read it wrongly.
Many think it only means you can use unicode characters for identifiers, like $möhre or sub née but it covers also literal strings read thru the same file-handle DATA.
Please note how the UTF8 flag is set for $t2 (see FLAGS)
OUTPUT:use v5.12; use warnings; use Devel::Peek; my $t1='åäö'; Dump $t1; use utf8; my $t2='åäö'; Dump $t2; my $t3 = "\N{LATIN SMALL LETTER A WITH RING ABOVE}\n"; say $t3; Dump $t3;
SV = PV(0xd9ae08) at 0x25809b0 REFCNT = 1 FLAGS = (POK,IsCOW,pPOK) PV = 0x260a4e8 "\303\245\303\244\303\266"\0 CUR = 6 LEN = 10 COW_REFCNT = 1 SV = PV(0xd9add8) at 0x2580248 REFCNT = 1 FLAGS = (POK,IsCOW,pPOK,UTF8) PV = 0x260a068 "\303\245\303\244\303\266"\0 [UTF8 "\x{e5}\x{e4}\x{f6 +}"] CUR = 6 LEN = 10 COW_REFCNT = 1 SV = PV(0xd9afe8) at 0x2580a40 REFCNT = 1 FLAGS = (POK,IsCOW,pPOK,UTF8) PV = 0x2767378 "\303\245\n"\0 [UTF8 "\x{e5}\n"] CUR = 3 LEN = 10 COW_REFCNT = 1 å
extended the code with $t3, which doesn't print an empty line for me but å
of course, how the print is displayed depends also on the output channel and the display settings.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re^4: UTF8 Output with XML::Feed? (updated)
by LanX
in thread UTF8 Output with XML::Feed?
by mldvx4
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |