Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: UTF8 Output with XML::Feed? (use utf8)

by LanX (Saint)
on Mar 07, 2022 at 20:02 UTC ( [id://11141894]=note: print w/replies, xml ) Need Help??


in reply to Re^2: UTF8 Output with XML::Feed? (use utf8)
in thread UTF8 Output with XML::Feed?

I can't comment on XML::Feed, sorry.

But ...

> Adding use utf8; was one of the first things I tried.

... if your source-code is in utf8 (check your editor settings) and you have a line like my $t='abc...едц'; you must apply use utf8;

Otherwise Perl will not know how to decode the bytes in that string, because the interpretation is not obvious.

You should clarify this, before meddling with XML.

Here a demo you should run:

use v5.12; use warnings; use Data::Dump; my $t1='едц'; ddx $t1; say "length: ",length $t1; use utf8; my $t2='едц'; ddx $t2; say "length: ",length $t2;
OUTPUT:
# demo_utf8.pl:8: "\xC3\xA5\xC3\xA4\xC3\xB6" <-- bytes length: 6 # demo_utf8.pl:14: "\xE5\xE4\xF6" <-- code p +oints length: 3

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11141894]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-04-19 20:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found