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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:22:56+00:00 2026-06-03T17:22:56+00:00

I have a simple print script my $pdf_data = $agent->content; open my $ofh, ‘>:raw’,

  • 0

I have a simple print script

my $pdf_data = $agent->content;
open my $ofh, '>:raw', "test.pdf"
or die "Could not write: $!";
print {$ofh} $pdf_data;
close $ofh;

Sometimes I get the “Wide character warning”, I know why I receive this and would like to be able to cancel the print instead of printing a corrupted fail. Something like

if(wideCharWarning)
{
delete "test.pdf"
}
else{
print {$ofh} $pdf_data;
}
  • 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-03T17:22:57+00:00Added an answer on June 3, 2026 at 5:22 pm

    You specified you’re printing bytes (:raw), but you’re not.

    $ perl -we'
       open(my $fh, ">:raw", "file") or die $!;
       for (0..258) {
          print "$_\n";
          print $fh chr($_);
       }
    '
    ...
    249
    250
    251
    252
    253
    254
    255
    256
    Wide character in print at -e line 5.
    257
    Wide character in print at -e line 5.
    258
    Wide character in print at -e line 5.
    

    To “cancel the print”, you simply have to check that what you print doesn’t contains non-bytes.

    die if $to_print =~ /[^\x00-\xFF]/;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple python script test.py : #!/user/bin/python print Why is it not
Say I have this simple python script: file = open('C:\\some_text.txt') print file.readlines() print file.readlines()
I have a simple CGI python script with an html output: print Content-Type: text/html
I have a simple hello world python script: #!/usr/bin/python print Content-Type: text/html print print
I have simple python script, 'first.py': #first.py def firstFunctionEver() : print hello firstFunctionEver() I
Let's say I have the following simple script: print ID : ; $ID =
Let's say we have the following mega-simple Python script: print Initializing.... a=10 print Variable
I have a simple script blah.py (using Python 2): import sys print sys.argv[1] If
I have a simple script: now = datetime.datetime.now() print %d%d%d%d%d % ( now.year, now.month,
I have a simple IronPython script: # Foo.py import os def main(): print( Hello

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.