Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

XML::Twig (keep_encoding)

by arivu198314 (Sexton)
on May 07, 2012 at 13:37 UTC ( #969259=perlquestion: print w/ replies, xml ) Need Help??
arivu198314 has asked for the wisdom of the Perl Monks concerning the following question:

I'm wondering this object is working or not, because I'm sending the input as UTF-8 characters, but the twig is returning back as junk, see below for more...

Input:

<title>Division II the Sources of Lawyers’ Legal and Ethical Duties</t +itle>

Output: the Original symbol replaced by entity values, its actually two small boxes in the original output

<title>The Sources of Lawyersâ&#128;&#153; Legal and Ethical Duties</title>

My bit of code is below

use open qw/:std :utf8/; XML::Twig->new(keep_encoding=>1)

It would be great if anyone give a needful solution for this

Comment on XML::Twig (keep_encoding)
Select or Download Code
Replies are listed 'Best First'.
Re: XML::Twig (keep_encoding)
by mirod (Canon) on May 07, 2012 at 15:41 UTC

    If you post your complete code, we'll have a better chance to figure out what you are doing. What you posted doesn't output anything!

    That said, if you're dealing with UTF-8 input, don't use keep_encoding, it's there mostly for dealing with other encodings.

      I know its very hard to find out the error without code, but i need some random answer just like this, means i have used both UTF-8 as well as keep_encoding, now i have removed it and it is working great.

      Thank you so much for this...

Re: XML::Twig (keep_encoding)
by zwon (Monsignor) on May 07, 2012 at 14:39 UTC
    Could you provide us with a complete example demonstrating the problem. Note, that use open only affect opens within a lexical scope of the pragma, it has no effect on opens inside XML::Twig.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://969259]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (14)
As of 2015-07-28 14:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (255 votes), past polls