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

  • Home
  • SEARCH
  • 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 6860133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:22:13+00:00 2026-05-27T02:22:13+00:00

When I trying to download some HTML file with the code below: $mech->get($link) $mech->save_content(file.html);

  • 0

When I trying to download some HTML file with the code below:

$mech->get($link)
$mech->save_content("file.html");

I get the warning:

Wide character in print at C:/strawberry/perl/site/lib/WWW/Mechanize.pm line 2040.

Could someone explain how I can repair this warning?

  • 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-27T02:22:14+00:00Added an answer on May 27, 2026 at 2:22 am

    You’ll need to ensure that the output filehandles are opened with the proper encoding.

    From a brief glance at the docs, it doesn’t look like Mech has configurable encodings for saved files, so you can grab the content and save it yourself:

    $mech->get( $link );
    my $content = $mech->content;
    
    open my $fh, '>:utf8', $file or die "$file: $!";
    print $fh $content;
    

    The :utf8 bit in the open will make sure that data sent to the filehandle is encoded properly as UTF-8.

    Another way to do it is to encode manually:

    use Encode;
    my $content = encode 'utf8', $mech->content;
    
    open my $fh, '>', $file or die "$file: $!";
    binmode $fh;
    print $fh $content;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to download an html file with curl in bash. Like this site:
I'm trying to download all png files contained in an html file. I have
I'm trying to use the NAnt <get> task to download some artifacts from our
I'm trying to download some remote pages. In the source code there is a
I am trying to download a CSV file using HttpResponse to make sure that
I'm trying to download http://www.downway1.com/dota/eng/DotA%20Allstars%20v6.67.w3x this file. But it's not able to download. It's
I was trying to download some ASP.NET MVC Sample application to learn MVC. I
I'm trying to do some progress indication for when trying to upload and download
I have a site, from which you can download an HTML file. This HTML
I am trying to use an XMLHTTPRequest to download an .xml file and add

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.