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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:10:58+00:00 2026-05-20T05:10:58+00:00

Why do I get from the second loop (CHECK-argument set) a different output? #!/usr/bin/env

  • 0

Why do I get from the second loop (CHECK-argument set) a different output?

#!/usr/bin/env perl
use warnings;
use 5.012;
use Encode qw(encode);
my $s = 'a';

for my $encoding ( 'iso-8859-1', 'iso-8859-15', 'cp1252', 'cp850' ) {
    my $encoded = encode( $encoding, $s );
    my $c = unpack '(B8)*', $encoded;
    printf "%-12s:\t%8s\n", $encoding, $c;
}

say "-------------------";

for my $encoding ( 'iso-8859-1', 'iso-8859-15', 'cp1252', 'cp850' ) {
    my $encoded = encode( $encoding, $s, Encode::FB_WARN );
    my $c = unpack '(B8)*', $encoded;
    printf "%-12s:\t%8s\n", $encoding, $c;
}


# iso-8859-1  :   01100001
# iso-8859-15 :   01100001
# cp1252      :   01100001
# cp850       :   01100001
# -------------------
# iso-8859-1  :   01100001
# Use of uninitialized value $c in printf at ./perl1.pl line 20.
# iso-8859-15 :           
# Use of uninitialized value $c in printf at ./perl1.pl line 20.
# cp1252      :           
# Use of uninitialized value $c in printf at ./perl1.pl line 20.
# cp850       :   
  • 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-20T05:10:59+00:00Added an answer on May 20, 2026 at 5:10 am

    The behavior is described in documentation (see snip below) – it modifies data and leaves unprocessed portion in $s. Since there is no error, it basically clears your variable.

    *CHECK* = Encode::FB_QUIET
      If *CHECK* is set to Encode::FB_QUIET, (en|de)code will immediately
      return the portion of the data that has been processed so far when an
      error occurs. The data argument will be overwritten with everything
      after that point (that is, the unprocessed part of data). This is
      handy when you have to call decode repeatedly in the case where your
      source data may contain partial multi-byte character sequences, (i.e.
      you are reading with a fixed-width buffer). Here is a sample code that
      does exactly this:
    
        my $buffer = ''; my $string = '';
        while(read $fh, $buffer, 256, length($buffer)){
          $string .= decode($encoding, $buffer, Encode::FB_QUIET);
          # $buffer now contains the unprocessed partial character
        }
    
    *CHECK* = Encode::FB_WARN
      This is the same as above, except that it warns on error. Handy when
      you are debugging the mode above.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to get the value from the first page to the second
How can I get the current hour, minutes, and seconds from this? NSDate *now
I get from another class string that must be converted to char. It usually
from pack.mod import f How to get from object f information about import -
I'm trying to get from an Android Uri to a byte array. I have
I'm trying to get from Line #1 to Line #2 in the below code:
How to get from this dict: cats = [ {'parent_id': False, 'id': 1, 'title':
I have an html string that I get from the response of a website.
Basically the question is how to get from this: foo_id foo_name 1 A 1
Anyone got an idea how to get from an Xserver the list of all

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.