openvpn-gui icon indicating copy to clipboard operation
openvpn-gui copied to clipboard

The text is displayed abnormally

Open z2z2qp opened this issue 3 years ago • 37 comments

1、window 11 2、 image 3、显示乱码 image 此处乱码应该是“任务栏”的务

z2z2qp avatar Apr 17 '22 11:04 z2z2qp

In the sources for Chinese-simplified we have

"OpenVPN GUI 已经运行. 右击任务栏图标启动." Not sure why one character is garbled on your display.

See the link for the line in the source -- does it show up correctly on your machine? https://github.com/OpenVPN/openvpn-gui/blob/79f5cb91c68308cbaa8bd0ef7d45da63e2f4dfc6/res/openvpn-gui-res-zh-hans.rc#L527

selvanair avatar Apr 18 '22 01:04 selvanair

“See the link for the line in the source -- does it show up correctly on your machine?” it's ok

I clone the project,it's ok use cat command image use vs code image use nodepad image

z2z2qp avatar Apr 19 '22 02:04 z2z2qp

This notification displays correctly on my English version of Windows 10 with language selected as Chinese in the settings menu of OpenVPN-GUI. The text is sent using COPYDATA message from the second instance to the first, so the corruption could be in the inter-process messaging if all other notifications generated within the process are working right. Have you tried disabling the beta UTF-8 support in Windows 11?

selvanair avatar Apr 19 '22 05:04 selvanair

@selvanair , it was very easy (for me) to run win11 on my dev machine. I enabled Hyper-V and ran "create new vm" wizard, it allows you to choose "windows 11 dev env"

or maybe those prepared images: https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/

chipitsine avatar Apr 19 '22 05:04 chipitsine

This notification displays correctly on my English version of Windows 10 with language selected as Chinese in the settings menu of OpenVPN-GUI. The text is sent using COPYDATA message from the second instance to the first, so the corruption could be in the inter-process messaging if all other notifications generated within the process are working right. Have you tried disabling the beta UTF-8 support in Windows 11?

OH! ON! image

z2z2qp avatar Apr 19 '22 07:04 z2z2qp

The suggestion to disable UTF-8 beta was a stab in the dark.. @chipitsine Thanks for the Windows 11 VM suggestion... Could anyone with Win11 please try with Chinese (simplified) as the language in OpenVPN-GUI settings, then start a second instance of the GUI to trigger that message?

selvanair avatar Apr 19 '22 14:04 selvanair

screen

Is this good or bad? :)

lstipakov avatar Apr 19 '22 15:04 lstipakov

Is this good or bad? :)

Looks good to me ...

selvanair avatar Apr 19 '22 15:04 selvanair

I have similar problem but in GUI and in another language image

playday3008 avatar May 14 '22 08:05 playday3008

No such error on my Win 10 (English) desktop. Is this also WIndows 11? @z2z2qp did you find a fix? settings-ua

selvanair avatar May 14 '22 14:05 selvanair

Interesting, I have the same problem with Ukrainian language - some characters are displayed incorrectly. Finnish (including non-ASCII chars) looks fine.

UA

FI

lstipakov avatar May 16 '22 07:05 lstipakov

On the other hand, I cannot reproduce it with openvpn-gui.exe built locally or from GitHub Actions. @playday3008 could you try out this executable? https://github.com/OpenVPN/openvpn-gui/suites/6443033222/artifacts/235955420

lstipakov avatar May 16 '22 07:05 lstipakov

On the other hand, I cannot reproduce it with openvpn-gui.exe built locally or from GitHub Actions. @playday3008 could you try out this executable? https://github.com/OpenVPN/openvpn-gui/suites/6443033222/artifacts/235955420

image

playday3008 avatar May 16 '22 09:05 playday3008

I checked locally-built installer and it works fine. Then I checked official installers and noticed that problem has appeared since 2.5.3 - 2.5.2 and older works fine.

lstipakov avatar May 16 '22 10:05 lstipakov

I checked locally-built installer and it works fine. Then I checked official installers and noticed that problem has appeared since 2.5.3 - 2.5.2 and older works fine.

So, what's next? How to fix that bug?

playday3008 avatar May 16 '22 11:05 playday3008

@mattock do you happen to remember what has changed since 2.5.3? Have we switched to MSVC building? Maybe some settings on build machine?

lstipakov avatar May 16 '22 11:05 lstipakov

https://github.com/OpenVPN/openvpn-gui/compare/OpenVPN-2.5.2-I601...OpenVPN-2.5.3-I601

playday3008 avatar May 16 '22 11:05 playday3008

I am not sure the problem is in -gui changes. As we could see, GitHub Actions-built and locally-built binaries work fine - there is probably some change in build environment which has caused it.

lstipakov avatar May 16 '22 11:05 lstipakov

Aha, I can also reproduce these using the release binary (including @z2z2qp 's original report for simplified chinese) -- I have been testing using a local build. Has to be a release build issue as locally built GUI work fine as Lev mentioned.

Hard to think of how something in the build system could cause this though.

selvanair avatar May 16 '22 12:05 selvanair

2.5.7 which was released after this report, still has the same problem, @mattock any idea why only release binaries are affected by this?

settings

selvanair avatar Jul 08 '22 01:07 selvanair

It seems we still have this issue unresolved in 2.6_beta2. Wonder what change in the build process could have caused this. GHA build looks fine, only the "official" release builds are affected.

selvanair avatar Dec 17 '22 05:12 selvanair

Windows 7, OpenVPN version 2.6.3, OpenVPN GUI 11.41.0.0, OS language and OpenVPN GUI Russian. In the "display status" window, part of the message in Russian with the wrong character set (highlighted in the screenshot). If you select "show log" and open it in Notepad++, it shows character set Cyrillic Macintosh instead of the usual Cyrillic Windows-1251, while the word "Элемент" is displayed incorrectly as "Ёлемент" (highlighted in the screenshot). This error has appeared since version 2.6.0, if memory serves me correctly.

sshot-4 sshot-5

mastezont avatar Apr 16 '23 19:04 mastezont

The GUI and openvpn.exe treats all text as unicode, no ANSI code pages are involved. Log messages are displayed on the GUI status window by setting code page = CP_UTF8. As for the log file itself, again, all text is supposed to be unicode encoded as utf-8.

Possibly there is an issue in openvpn.exe when Windows errors are converted to utf-8. Have to check.

selvanair avatar Apr 17 '23 02:04 selvanair

Note: this may be moved to OpenVPN/openvpn

In error.c in openvpn we have

/* format a windows error message */
    {
        char message[256];
        struct buffer out = alloc_buf_gc(256, gc);
        const int status =  FormatMessage(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM
            | FORMAT_MESSAGE_ARGUMENT_ARRAY, NULL, errnum, 0,
            message, sizeof(message), NULL);

This will call the ANSI version and return "message" using the current code page while the implicit assumptions is that all strings are unicode in utf-8 encoding. I think we should call FormatMessageW() here and convert the result to utf-8.

selvanair avatar Apr 17 '23 13:04 selvanair

Note: this may be moved to OpenVPN/openvpn.

Is it necessary for me to do this, or can you do it more competently?

mastezont avatar Apr 17 '23 14:04 mastezont

As the original report in this thread is GUI-specific, we cannot transfer this. Instead, I opened a new issue in OpenVPN referring to this one. See https://github.com/OpenVPN/openvpn/issues/319

selvanair avatar Apr 17 '23 15:04 selvanair

Thank you for your excellent work. Good luck!

mastezont avatar Apr 17 '23 15:04 mastezont

@mastezont Could you check whether openvpn.exe from the GHA artifacts below fixes it?

https://github.com/selvanair/openvpn/actions/runs/4725113811#artifacts Correspondin source tree is https://github.com/selvanair/openvpn/tree/master

Replacing only openvpn.exe binary with one from above build should be enough.

selvanair avatar Apr 17 '23 21:04 selvanair

Replaced the binary file openvpn.exe on a similar one from the artifacts-x64 build. As a result, the error display in Russian in the GUI window is shown correctly. In Notepad++, the same error in the log is displayed incorrectly with the Cyrillic Windows-1251 code page, and is displayed correctly if the UTF-8 code page is forcibly installed. This error is displayed correctly in the system Notepad. Here I am not sure which code page is installed by default in Windows 7 with Russian localization. sshot-10 sshot-11 sshot-12

mastezont avatar Apr 18 '23 10:04 mastezont

Thanks for testing

In Notepad++, the same error in the log is displayed incorrectly with the Cyrillic Windows-1251 code page, and is displayed correctly if the UTF-8 code page is forcibly installed. This error is displayed correctly in the system Notepad. Here I am not sure which code page is installed by default in Windows 7 with Russian localization.

Its not about the default code page, but Unicode vs ANSI. The content of the log file is in Unicode. Most modern applications create Unicode files and ANSI code pages are only required to read legacy files. Set your editor to use Unicode/UTF-8. Notepad seems to do this automatically since Windows 10. No idea about notepad++.

selvanair avatar Apr 18 '23 13:04 selvanair