Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: I love XML::Twig

by Joost (Canon)
on Oct 06, 2006 at 16:12 UTC ( #576702=note: print w/replies, xml ) Need Help??

in reply to I love XML::Twig

XML::Twig is great stuff. I use it quite a bit. The only issue I've had with it is that for some reason (seems to be XML::Parser's fault, but I'm not sure) the utf8 flag isn't set on the output strings (i.e. on $_->text(), $_->xml_string() etc) even though they return utf8 encoded by default.

update (2006-10-20) This appears to be a problem in a very old version of XML::Twig, I cannot reproduce it with later versions. (v3.15 and up)

Replies are listed 'Best First'.
Re^2: I love XML::Twig
by mirod (Canon) on Oct 06, 2006 at 16:38 UTC

    Hum, I'll have to check that. Does this happen with a specific version of Perl, or in any 5.8.*?

    As you mention, the problem most likely comes from XML::Parser, which was written when 5.5 was still cutting edge, and has been in "light maintenance mode" for quite some time now. That doesn't prevent me from fixing it in XML::Twig though (the length of the RT queue leaves me little hope that XML::Parser itself will be fixed anytime soon).

    More generally, please, please, let me know if you find any bug in the module, I am more than happy to fix them if I can.

        Do you have a test case? I tried a couple of tests and could not reproduce the problem:

        perl -MXML::Twig -l -MEncode -e'print Encode::is_utf8( XML::Twig->npar +se( "<d>foo</d>")->root->text)' perl -MXML::Twig -l -MEncode -e'print Encode::is_utf8( XML::Twig->npar +se( qq{<?xml version="1.0" encoding="ISO-8859-1"?><d>foo</d>})->root- +>text)'

        Both give me a result of 1

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://576702]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2018-01-17 02:01 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (194 votes). Check out past polls.