-
-
Notifications
You must be signed in to change notification settings - Fork 570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WriteConsoleW used with ConEmu duplicates Chinese characters output #945
Comments
|
1] 2]
123456789也也不不是是可可运运行行的的程程序序112233445566778899 Check AÀÀΑΑ╬╬豈豈AAꊠꊠ黠黠だだ➀ጀะڰЯ09 ╔══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╦╦══ |
@miniksa Can you take a look at this? Reported already several times here. |
@Maximus5 I've filed it as MSFT:9751066 internally and assigned to myself. I'm currently in a deep thought on something else, so I'll probably get to it early next week. Thanks for the report. |
I see the issue. There appear to be duplicates coming out of ReadConsoleOutputW/A. I'm not sure what happened there. I'll have to keep investigating, but it looks like it will need a fix on our side once I figure it out. |
Perhaps this comes from changes in attributes processing. I noted some time ago (not sure where exactly) that new Windows build process high byte of console attributes "in proper and better way"... |
FYI, I haven't forgotten about this investigation. We've just suddenly got slammed with e-mails and bugs from all sources and so getting to investigating this may take me significantly longer than I originally predicted. I will be back when I get a chance. |
FYI, the fix for this should have just landed with Insider Build 15014 today. |
Just tested Build 15014. Not fixed yet. |
Hmmm. Not sure what's up. I'll dig into character handling stuff today. |
@miniksa Finally I managed to install insider build. First, the expected behavior from "stable" Win10 build. All glyphs are written and displayed properly, no doubled CJK and data properly fit on screen. Now the 15014.I'm still checking the results, here first notes.
Finally. Here are drawing bugs during selection in conhost's window. I selected one by one cells with mouse. Cells have unexpected width during selection. And strangely the line below the selection is broken during selection. |
@miniksa Inconsistency of API... WriteConsoleOutputAttribute, WriteConsoleOutputCharacter, ReadConsoleOutputCharacter, ReadConsoleOutputAttribute, ReadConsoleOutput... |
Yeah, I was finding bad behavior like this yesterday as well. Part of the deal is that it behaves differently with Raster Fonts vs. TrueType fonts as well. I'll probably be spending the rest of the week on trying to fix this up and make it consistent. I don't know what SM_DBCSENABLED is/does. Console's DBCS check has always been based on the active code page (is equal to 932, 949, 950, 936) not that system metric. I'll try to keep you posted as I figure this out. Sorry about that. A few of us have been working on trying to fit UTF-8 support into the console (not done yet) and it appears to have messed up quite a few DBCS routes. |
I used to check GetSystemMetrics(SM_DBCSENABLED) which actually was 1 only for Windows installations developed for China, Japan, Korea (CJK). |
I'll have to get back to you on that. Everything you are telling me about SM_DBCSENABLED is 100% new information to me. I don't really know if that particular metric used to be a part of the console code in XP/Vista/7/8. I can look. I also don't know what in the system turns that metric on or off. From what I know about the console from Win 8.1 to today, the console always did its conversions and width calculations based on code page. It's just that prior to recently, it used to prohibit changing into a CJK codepage unless your system's non-Unicode region was set to a CJK language (Control Panel-->Region-->Administrative-->Language for non-Unicode programs). I've been trying to remove that restriction to allow anyone to swap into any codepage no matter their "non-Unicode region" because in today's editions of Windows (as opposed to the CJK-specific ones of the 1990s), you can add just about any language pack and IME and font to any language edition of Windows, so the "non-Unicode" region doesn't really matter like it used to several decades ago. My plan is:
|
So I've got through 1, 2, and 3 in MSFT: 10187355 which is checked in and will start shipping up to Insiders builds. Probably be there in a few weeks. I've basically restored the console's behavior to the same as what it was for the legacy console. If it works against the console with the legacy box checked, it will work again against the updated one once the Insider build updates. For part 4, I'm still working on it. I basically need to write up the way that the v1/legacy console did it and publish that. |
@miniksa @Maximus5 FWIW, this VSCode/winpty issue seems related: microsoft/vscode#19665. ConEmu is broken in exactly the same way (screenshot in this comment, microsoft/vscode#19665 (comment)). I wrote a test case demonstrating the new (broken?) behavior as of Win10 v15048. |
I try Chinese on the UTF8 version of Newlisp. https://stackoverflow.com/questions/3911536/utf-8-unicode-whats-with-0xc0-and-0x80 |
Versions
ConEmu build: 161023 x64 stable
OS version: Windows 10 x64 (1607)
Microsoft Windows [version 10.0.14959] cmd
Problem description
WriteConsoleW duplicates chinese characters
Steps to reproduce
Actual results
Output: Traditional Chinese 漢漢字字
Expected results
Original string: Traditional Chinese 漢字
Additional files
build this code with VS 2015 C++:
#include <Windows.h>
#include
int main()
{
std::wstring msg = L"Traditional Chinese 漢字";
HANDLE consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
WriteConsoleW(consoleHandle, msg.c_str(), msg.size(), NULL, NULL);
return 0;
}
The text was updated successfully, but these errors were encountered: