Skip to content

<iostream> : When a double-width characters in cout, blank output without permission. #1122

@fsb4000

Description

@fsb4000

Describe the bug
When the full-width character is output in cout, blank is output without permission

Command-line test case

C:\Temp>type main.cpp
//  file encoding: utf-8 or Shift JIS
#include <iostream> 
#include <cstdlib>
using namespace std;

int main()
{ 
	system("chcp 932 > NUL"); // system("chcp 65001 > NUL");
	cout << "あいうえお" << endl;
}

C:\Temp>cl /EHsc /W4 /WX /utf-8 main.cpp
or
C:\Temp>cl /EHsc /W4 /WX main.cpp
Оптимизирующий компилятор Microsoft (R) C/C++ версии 19.27.29109 для x64
(C) Корпорация Майкрософт (Microsoft Corporation).  Все права защищены.

main.cpp
Microsoft (R) Incremental Linker Version 14.27.29109.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:main.exe
main.obj

C:\Temp>main.exe
あいうえお

Expected behavior
Should print without additional spaces.
Actually it works. I can't reproduce the bug.
Works for both utf-8 and Shift JIS.

test

STL version
Microsoft Visual Studio Community 2019 Preview Version 16.7.0 Preview 6.0

Additional context
VSO-441122 / AB#441122 | DevCom-59694

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginvalidThis issue is incorrect or by design

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions