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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:48:31+00:00 2026-06-07T07:48:31+00:00

I have some weird problem while uploading a file with a Cyrillic name using

  • 0

I have some weird problem while uploading a file with a Cyrillic name using WWW::Mechanize. The file is uploaded correctly but the name is broken (I see only ?????? on the target site).

The code is simple:

use WWW::Mechanize;
use Encode qw(from_to);

my $config = {

    login         => "login",
    password      => "pass",
    source_folder => "$Bin/source_folder",
};

my $mech = WWW::Mechanize->new( autocheck => 1 );
$mech->agent_alias("Windows IE 6");

$mech->get("http://www.antiplagiat.ru/Cabinet/Cabinet.aspx?folderId=689935");
authorize($mech);

$mech->submit_form(

    form_number => 1,
    fields      => {},
    button =>
'ctl00$ctl00$Body$MainWorkSpacePlaceHolder$FolderControl_StdFolder_0$DocumentsGrid$btnAddItem',
);

find( \&wanted, $config->{source_folder} );

sub wanted {

    return unless -f;

    say $config->{source_folder} . "/" . $_;

    #from_to($_, "CP1251", "UTF8"); doesn't work too :-(

    my $mech = $mech->clone();
    $mech->submit_form(

        form_number => 1,
        fields      => {

            'ctl00$ctl00$Body$MainWorkSpacePlaceHolder$fuDocumentUpload' =>
              $config->{source_folder} . "/" . $_,
        },
        button => 'ctl00$ctl00$Body$MainWorkSpacePlaceHolder$btnCommitUpload',
    );
}

If I encode the file name from CP1251 to UTF8 then the upload doesn’t work. Please help me to find a solution.

  • 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-07T07:48:33+00:00Added an answer on June 7, 2026 at 7:48 am

    Here is solution I use:

       my $filename = $_;
        from_to( $filename, "CP1251", "UTF8" );
    
        my $mech = $mech->clone();
    
        my $form = $mech->form_number(1);
        $mech->field( 'ctl00$ctl00$Body$MainWorkSpacePlaceHolder$fuDocumentUpload',
            $config->{source_folder} . "/" . $_ );
        $form->find_input(
            'ctl00$ctl00$Body$MainWorkSpacePlaceHolder$fuDocumentUpload')->filename($filename);
        $mech->submit_form(
    
            form_number => 1,
            button => 'ctl00$ctl00$Body$MainWorkSpacePlaceHolder$btnCommitUpload',
        );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a weird problem. i fetch some rows from database using: while($tag =
Hello I have a problem with trimming string in c++. It adds some weird
I have encountered a weird situation while updating/upgrading some legacy code. I have a
My first issue: Because of some weird problem with Firefox I have to put
While I have the problem itself seemingly resolved, I'm hoping someone can shed some
I have a very weird problem. I have a webpage that displays some graphs
So I have a very weird problem. I am writing some code in VB.Net
I have a weird problems with NSArray where some of the members of the
I have a large data.frame displaying some weird properties when plotted. I'd like to
I have a weird issue. I have some icons that are being built based

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.