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

The text is displayed abnormally #491

Open
z2z2qp opened this issue Apr 17, 2022 · 37 comments
Open

The text is displayed abnormally #491

z2z2qp opened this issue Apr 17, 2022 · 37 comments
Labels

Comments

@z2z2qp
Copy link

z2z2qp commented Apr 17, 2022

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

@selvanair
Copy link
Collaborator

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?

IDS_NFO_CLICK_HERE_TO_START "OpenVPN GUI 已经运行. 右击任务栏图标启动."

@z2z2qp
Copy link
Author

z2z2qp commented Apr 19, 2022

“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

@selvanair
Copy link
Collaborator

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?

@chipitsine
Copy link
Contributor

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

@z2z2qp
Copy link
Author

z2z2qp commented Apr 19, 2022

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

@selvanair
Copy link
Collaborator

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?

@lstipakov
Copy link
Member

screen

Is this good or bad? :)

@selvanair
Copy link
Collaborator

Is this good or bad? :)

Looks good to me ...

@playday3008
Copy link
Contributor

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

@selvanair
Copy link
Collaborator

selvanair commented May 14, 2022

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

@lstipakov
Copy link
Member

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

UA

FI

@lstipakov
Copy link
Member

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

@playday3008
Copy link
Contributor

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

@lstipakov
Copy link
Member

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.

@playday3008
Copy link
Contributor

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?

@lstipakov
Copy link
Member

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

@playday3008
Copy link
Contributor

@lstipakov
Copy link
Member

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.

@selvanair
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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 selvanair added the bug label Dec 17, 2022
@mastezont
Copy link

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

@selvanair
Copy link
Collaborator

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
Copy link
Collaborator

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.

@mastezont
Copy link

Note: this may be moved to OpenVPN/openvpn.

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

@selvanair
Copy link
Collaborator

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 OpenVPN/openvpn#319

@mastezont
Copy link

Thank you for your excellent work.
Good luck!

@selvanair
Copy link
Collaborator

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

@mastezont
Copy link

mastezont commented Apr 18, 2023

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

@selvanair
Copy link
Collaborator

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

@mastezont
Copy link

Thank you for the quick solution of the problem!

@lstipakov
Copy link
Member

Windows-1251

Is KOI-8 still the thing?

/me apologizes for hijacking the thread.

@mastezont
Copy link

mastezont commented Apr 19, 2023

Is KOI-8 still the thing?

I don't know how to define it.

@chipitsine
Copy link
Contributor

hello, everyone.

I added BOM to res/openvpn-gui-res-ru.rc and my issue is gone.
can you please check whether adding BOM help to resolve your issues as well ?

@selvanair
Copy link
Collaborator

The report in #491 is against the release version, not a local build by the user. That said, we use pragma code_page(65001) so that all res files should get interpreted as UTF-8 without BOM. At least my local builds I do not see these mangled characters in any languages. So, unclear what exactly triggers this.

@Neustradamus
Copy link

Any news about this character problem?

@mastezont
Copy link

I have no problems with new versions.

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

No branches or pull requests

7 participants