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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:49:06+00:00 2026-05-20T07:49:06+00:00

In this output, why am I getting extra newlines after printing non-ASCII Unicode characters?

  • 0

In this output, why am I getting extra newlines after printing non-ASCII Unicode characters?

Platform is Windows Vista and problem occurs after chcp 65001 but not after chcp 850

C:\>chcp 850
Active code page: 850

C:\>perl unicode_bug_1.pl
Budweiser
Budweiser
Budweiser
Bud─øjovick├¢ Budvar
Bud─øjovick├¢ Budvar
Bud─øjovick├¢ Budvar

C:\>chcp 65001
Active code page: 65001

C:\>perl unicode_bug_1.pl
Budweiser
Budweiser
Budweiser
Budějovický Budvar

Budějovický Budvar

Budějovický Budvar

from this program

#!perl
use strict;
use warnings;

binmode (STDOUT, "encoding(UTF-8)"); # so no "Wide character in print" warning

print "Budweiser\n" for 1..3;
print "Bud\N{U+011B}jovick\N{U+00FD} Budvar\n" for 1..3;
  • 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-20T07:49:06+00:00Added an answer on May 20, 2026 at 7:49 am

    This seems to be a bug in Perl. I had thought it was a bug in Windows code page 65001 not really being supported for the console but I finally made test programs in C and Perl and the problem does not happen in the C version. It happens no matter where the Unicode character occurs in the line but the line you’re printing must be wider than the console supports.

    Here is my C program:

    #include "stdafx.h"
    
    #include "Windows.h"
    
    
    int _tmain(int argc, _TCHAR* argv[])
    {
        BOOL b = SetConsoleOutputCP(65001);
        printf("set console output codepage returned %d\n", b);
    
        printf("cαfe\n");
        printf("1234567890 café\n");
        printf("1234567890 1234567890 cαfe\n");
        printf("1234567890 1234567890 1234567890 café\n");
        printf("1234567890 1234567890 1234567890 1234567890 cαfe\n");
        printf("1234567890 1234567890 1234567890 1234567890 1234567890 café\n");
        printf("1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 cαfe\n");
        printf("1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 café\n");
        printf("1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 cαfe\n");
        printf("1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 café\n");
        printf("1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 cαfe\n");
        printf("1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 café\n");
        printf("1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 cαfe\n");
    
        return 0;
    }

    And here is my Perl program:

    #
    
    use utf8;
    
    binmode STDOUT, ':utf8';
    
    printf STDOUT "cαfe\n";
    printf STDOUT "1234567890 café\n";
    printf STDOUT "1234567890 1234567890 cαfe\n";
    printf STDOUT "1234567890 1234567890 1234567890 café\n";
    printf STDOUT "1234567890 1234567890 1234567890 1234567890 cαfe\n";
    printf STDOUT "1234567890 1234567890 1234567890 1234567890 1234567890 café\n";
    printf STDOUT "1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 cαfe\n";
    printf STDOUT "1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 café\n";
    printf STDOUT "1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 cαfe\n";
    printf STDOUT "1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 café\n";
    printf STDOUT "1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 cαfe\n";
    printf STDOUT "1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 café\n";
    printf STDOUT "1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 cαfe\n";

    UPDATE

    No I was wrong, with the help of some of the guys at #perl on irc.perl.org it turns out to be a bug in the Microsoft API. WriteFile is documented to return the number of bytes written but returns the number of characters written, which depends on the codepage. A bug was filed in March 2010.

    There is more discussion in the MSDN forums.

    UPDATE 2

    I posted Michael Kaplan’s blog, “Sorting it all out”, about this problem and he responded with the article entitled “Hidden in plain site: a purloined letter kind of a bug report”. He’s a Microsoft internationalization expert so you will surely find some insights there…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am getting the CSV output as in this photo, which inserts extra blank
This is the output I'm getting while compiling my class under Lubuntu 12.04 32bit
I am getting the output as 0,1,2,3. I need this to be split into
I'm getting this warning in my Output window (which doesn't affect functionality but I
I am getting a wrong output when i alert this, it shows '01' <input
I'm building this function but I'm not getting the desired output, it's been more
Can't seem to work out why I'm getting garbage output from this Linked List
Can someone please tell me where these extra characters are coming from? This is
Why does this output a 0 byte file? <?php $jsonurl = http://do.convertapi.com/Web2Pdf/json/?curl=http://stackoverflow.com/; $json =
There is this output of objdump on some object file: $ objdump -h main.o

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.