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 6986181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:46:34+00:00 2026-05-27T18:46:34+00:00

I use perl for ajax (POST method), and when I read POST query with

  • 0

I use perl for ajax (POST method), and when I read POST query with script below, I get my query URIencoded.

Example: sent – привет , received: %D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82

Latin queries work well. Script was just googled somewhere.

Script:

sub populatePostFields {
    %_POST = ();
    read( STDIN, $tmpStr, $ENV{ "CONTENT_LENGTH" } );
    @parts = split( /\&/, $tmpStr );
    foreach $part (@parts) {
        ( $name, $value ) = split( /\=/, $part );
        $value =~ ( s/%23/\#/g );
        $value =~ ( s/%2F/\//g );
        $_POST{ "$name" } = $value;
    }
}
  • 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-05-27T18:46:34+00:00Added an answer on May 27, 2026 at 6:46 pm

    Well, it’s not Perl-specific. The web browser is required to URI-encode the values when sending.

    You can use the standard use CGI module to decode form fields for you — this is definitely recommended, as it will take care of all kinds of edge cases for you, and is also usable if you decide to convert to a mod_perl module later.

    If you’re running a CGI script, I also strongly recommend that you have -T on the shebang line (#!/usr/bin/perl -T) and use strict;, to help catch things that might otherwise be easily exploitable over the web.

         #!/usr/bin/perl -T
         use strict;
         use CGI;
    
         my $q = CGI->new;
    
         print "Content-Type: text/html\n\n";
    
         print "<html><body><h1> Field FOO contains: ", $q->param('FOO'),
               "</h1></body></html>\n\n";
    

    →

         <html><body><h1> Field FOO contains: привет </h1></body></html>
    

    You can use the ->param(string) to read the various form fields; it’ll handle GET and POST transparently, and decode the URI-encoded strings for you.

    The “not-recommended, hard way” would be to use the expression:

           my ($name, $value) = split /\=/, $part;
           $value =~ s/\+/ /g;
           $value =~ s/(\%[0-9a-fA-F][0-9a-fA-F])/ (chr (hex $1)) /gex;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how do I use Perl to get rid of text within parentheses? For example:
So, this Perl script: http://hacheck.tel.fer.hr/xml.pl will return a XML result based on the POST
In a Perl script (with Ubuntu) I'd like to do something like use Blah;
I use perl as cgi for apache server,when each time the script encounters an
We use Perl for GUI test automation. It has been very successful. We have
I want to use Perl to extract information from a Certificate Signing Request ,
I know how to use Perl's Getopt::Long, but I'm not sure how I can
I want to use Perl's sprintf to zerofill a variable. sprintf(%08d, $var); But I
I've often seen people use Perl data structures in lieu of configuration files; i.e.
My Google fu is failing me. How do I use Perl to serve up

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.