[Openvpn-devel,v1] Set UTF-8 as the codepage using manifest declaration

Message ID 20251201090110.5487-1-gert@greenie.muc.de
State New
Headers show
Series [Openvpn-devel,v1] Set UTF-8 as the codepage using manifest declaration | expand

Commit Message

Gert Doering Dec. 1, 2025, 9:01 a.m. UTC
From: Selva Nair <selva.nair@gmail.com>

Works on Windows 10+. This ensures any UTF-8 string we pass to
ANSI API will not get interpreted in some local code page
in effect at runtime.

Although we do not use any such API, OpenSSL dll we link to
does (e.g., the store API used for reading certificate and
key from files). OpenSSL may fix this in future versions,
but this is an easy workaround that looks harmless and appropriate.

Fixes failure to read certificates when filenames contain non-ascii
characters reported by: Carsten Mietzsch <Carsten.Mietzsch@atelios.de>

Ref: https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page

Change-Id: Ic4e233c788b16a862c1fddcf314a3da661072fb5
Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1413
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1413
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Lev Stipakov <lstipakov@gmail.com>

Comments

Gert Doering Dec. 1, 2025, 11:11 a.m. UTC | #1
I have not tested it, nor fully read the documenation and the background
info - but the explanation makes sense.  Since this does not affect code,
all I tested was "does it still build?" - and it does (mingw).

I have added a reference to GH #920, as it seems we received multiple
reports on this.

Your patch has been applied to the master branch.

commit bcc7fb2d626ac428401a7877a8cc0098999a077e
Author: Selva Nair
Date:   Mon Dec 1 10:01:03 2025 +0100

     Set UTF-8 as the codepage using manifest declaration

     Signed-off-by: Selva Nair <selva.nair@gmail.com>
     Acked-by: Lev Stipakov <lstipakov@gmail.com>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1413
     Message-Id: <20251201090110.5487-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34805.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering
Selva Nair Dec. 1, 2025, 9:25 p.m. UTC | #2
>
> I have added a reference to GH #920, as it seems we received multiple
> reports on this.
>

Thanks. In fact, I attributed the "reported by:" to a wrong person --- oops!

Selva

Patch

diff --git a/src/openvpn/openvpn.manifest b/src/openvpn/openvpn.manifest
index fa5b3d7..f964152 100644
--- a/src/openvpn/openvpn.manifest
+++ b/src/openvpn/openvpn.manifest
@@ -14,6 +14,11 @@ 
             <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
         </application>
     </compatibility>
+    <application>
+        <windowsSettings>
+            <activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
+        </windowsSettings>
+    </application>
     <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
         <security>
             <requestedPrivileges>