Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8014209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:51:40+00:00 2026-06-04T19:51:40+00:00

I am having an issue which I am unable to solve after spending the

  • 0

I am having an issue which I am unable to solve after spending the last 10 hours searching around the internet for an answer.

I have some data in this format

??E?�?0?�?<?20120529184453+0200?20120529184453+0200?�?�?G0E?5?=20111213T103134000-136.225.6.103-30365316-1448169323, ver: 12?�?W??tP?2?�?
??|?????
??:o?????tP?�??B@?????B@????�?�?)0?�???
49471010550?�??	???tP???3??<?�?�?�?�??�?�?�?�?�??�?�?�?�?�

I have a PHP code, not written by me, which is just running html_entity_decode on that and it returns the correct results.

When I try running Perl’s decode_entities I get a completely different result. After some debugging it seems to me that PHP is “properly” replacing what seems to be invalid entities, such as, � or  into their ascii counterparts, namely NULL and backspace for the 2 cases mentioned.

Perl on the other hand does not seem to decode those “invalid” entities and leaves them alone which later one screws up the result (Which goes through unpack or, in phph’s case, bin2hex, which fails because rather than unpacking null to 00 it will unpack each individual character of �).

I have tried everything I can think of include running the following substitution in perl after running decode_entities

    $var =~ s/&#(\d+);/chr($1)/g

however that does not work at all.

This is driving me mad and I would like to have this done in perl rather than phpI really hope I don’t have to write 1000 pattern matching lines in perl to cover all possible entities and numbers.

Anybody that has an idea how to go about this problem without resorting to having to parse PHPs entire html_entity_decode function into perl or writing endless lines of pattern matching?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:51:43+00:00Added an answer on June 4, 2026 at 7:51 pm

    You’re almost there. Instead of

    $var =~ s/&#(\d+);/chr($1)/g
    

    say

    $var =~ s/&#(\d+);/chr($1)/ge
    

    The /e modifier instructs Perl to ‘e’valuate the replacement pattern.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having an annoying issue. I have a script which uses the $_GET
I'm having an issue building a grammar which is capable of parsing Python 3's
I'm having an issue when trying to do something which should be as easy
I am having an issue with the Color attribute for which I'm trying to
I'm currently having an issue storing mouse coordinates into an array in which a
I'm having an issue. I've implemented a PhaseListener, which is meant to add a
I ran dotTrace on my application (which is having some issues). IntPtr System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr, IntPtr,
I'm having an issue which looks like a memory leak in one of my
I have an issue with having a asp.net Grid View loaded into a div
I've been having an issue which is extremely odd to me. The graphic I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.