Skip to content
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

Unicode View Support For OutputDebugStringW #389

Open
luodaoyi opened this issue Oct 9, 2023 · 7 comments
Open

Unicode View Support For OutputDebugStringW #389

luodaoyi opened this issue Oct 9, 2023 · 7 comments
Assignees

Comments

@luodaoyi
Copy link

luodaoyi commented Oct 9, 2023

https://learn.microsoft.com/en-us/windows/win32/api/debugapi/nf-debugapi-waitfordebugeventex

https://learn.microsoft.com/zh-cn/windows/win32/api/debugapi/nf-debugapi-outputdebugstringw#remarks

OutputDebugStringW does internally call OutputDebugStringA, so Unicode characters that cannot be represented in the system code page will be replaced with ?.

Oddly enough, the OUTPUT_DEBUG_STRING_INFO structure the debugger receives from the operating system to print the message does appear to support letting the debugger know if the string is Unicode, it just doesn't appear to be used by OutputDebugStringW at all.

Unfortunately, I don't know of a mechanism to get the OS to raise a OUTPUT_DEBUG_STRING_EVENT with a Unicode string. It may not be possible with public APIs.

ref:

WaitForDebugEventEx function (debugapi.h)

windows - Is there a Unicode alternative to OutputDebugString? - Stack Overflow

@janwilmans
Copy link
Member

janwilmans commented Oct 9, 2023 via email

@luodaoyi
Copy link
Author

luodaoyi commented Oct 9, 2023

Example:

Change setting to Japanese. or Korean language.
Then call OutputDebugStringW("中文") with Chinese unicode charset.

In DebugView++ show: "????";

@janwilmans janwilmans self-assigned this Oct 10, 2023
@janwilmans
Copy link
Member

image

@janwilmans
Copy link
Member

janwilmans commented Oct 10, 2023

Please try changing the setting above, you can find it by searching for "Region" in the start menu, and send messages using OutputDebugStringW() and encoded as UCS-2 (windows own variant of UTF-16)

@janwilmans
Copy link
Member

Example:

Change setting to Japanese. or Korean language. Then call OutputDebugStringW("中文") with Chinese unicode charset.

In DebugView++ show: "????";

You mean when the language in the OutputDebugStringW is different from the non-unicode programs setting in the Region dialog?

@WebDancer69
Copy link

You mean when the language in the OutputDebugStringW is different from the non-unicode programs setting in the Region dialog?

Not necessarily the "language", but a lot of characters does not exist in the (limited) code page.
Like e.g. Greek characters (in math) and emojis. Even if you try to avoid using "foreign" / "complex" characters in debug messages you often print project data, which can contain any Unicode glyph.

Later>> no sorry I was confusing two projects, debugviewpp has no UTF-8 support.

Are you sure DebugViewPP does not support it? It should support it if it supports other MBCS.
image

@janwilmans
Copy link
Member

janwilmans commented Feb 22, 2024

well, debugview does not support UTF-8 natively, in code I assume everything is in UCS-2 but this windows feature might help, I am not sure. I will do some more testing. Let me know if you already found a solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants