Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Quick decode_entities Question

by Trihedralguy (Pilgrim)
on Jun 13, 2011 at 18:48 UTC ( #909423=perlquestion: print w/ replies, xml ) Need Help??
Trihedralguy has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks, I've been using encode_entities very successfully, it seemed better at the time, but I've been inserting my data into a db with encode_entities. Displaying them on a website was as simple as just select column from table. Now however, I would like to use that same data on a device that is not web, AKA doesnt render entities. I tried to do the following:
my $string = "foo   bar"; $string = decode_entities($string); print $string
But my data just comes back as my input, what I'm I doing wrong here?

Comment on Quick decode_entities Question
Download Code
Re: Quick decode_entities Question
by ikegami (Pope) on Jun 13, 2011 at 19:10 UTC

    Personally, I get

    Undefined subroutine &main::decode_entities called at -e line 2.

    Adding use HTML::Entities; provides the missing decode_entities, but you must be using something else if you're having the problem you describe.

Re: Quick decode_entities Question
by davido (Archbishop) on Jun 13, 2011 at 19:11 UTC

    What you have typed in there actually doesn't produce foo   bar? Is that the actual code that replicates the problem? Because it doesn't cause me any trouble at all, assuming I use HTML::Entities;

    Similarly, say decode_entities( encode_entities( 'this and that' ) ); produces exactly 'this and that' for me.

    Is it possible that in reducing the example to minimal code you eliminated the problem without realizing it? Because I can't duplicate it with that code.

    If the above code is giving you trouble I think we're going to need to know a little more about the rest of the neighborhood. That snippet cannot fail all by itself. What modules and pragmas are in use? Is there a character-set mismatch?


    Dave

      for me encode is working but decode is giving same error :( !!!
        the problem is on line 42, naturally

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2014-08-31 03:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (294 votes), past polls