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 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

Can someone please tell me where these extra characters are coming from? This is
I got this output when running sudo cpan Scalar::Util::Numeric jmm@freekbox:~/bfwsandbox/sa/angel/astroportal/dtu8e/resources$ sudo cpan Scalar::Util::Numeric [sudo]
I'm trying something like this Output.py print Hello Input.py greeting = raw_input(Give me the
html Tidy gives this as output for some reason: <?xml version=1.0 encoding=utf-16?> <?xml version=1.0
I have a DataSet consisting of XML data, I can easily output this to
Suppose you have output like this: Word1 Word2 Word3 Word4 Where the number of
Can any one explain why the output of this code is only 'hello' and
My stomach churns when I see this kind of output. http://www.freeimagehosting.net/uploads/e1097a5a10.jpg and this was
What's the most efficient way to convert the output of this function from a
this is my log output INFO main digestemails - process inbox INFO main digestemails

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.