From 71bbbd76c62630c88441237d72fe5b61f0b45b2a Mon Sep 17 00:00:00 2001 From: Heiko Hund Date: Fri, 10 Feb 2012 15:13:42 +0100 Subject: handle Windows unicode paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Openvpn for Windows is not compiled as a Unicode binary and thus cannot handle paths which contain non-ASCII characters using the argv vector. Characters that are not present in the system codepage are simply replaced with a question mark, e.g. if started as 'openvpn --config домой.ovpn' the file '?????.ovpn' is tried to be opened as configuration. The same applies to paths in config files which need to be UTF-8 encoded if they contain non ASCII characters. The option line 'key лев.pem' will lead to openvpn trying to open 'лев.pem' on a system with codepage 1252. This patch makes openvpn read the command line in UCS-2 and convert it to UTF-8 internally. Windows stores names in the filesystem in UCS-2. When using a paths openvpn converts it from UTF-8 to UCS-2 and uses the wide character Windows API function. Signed-off-by: Heiko Hund Acked-by: David Sommerseth Signed-off-by: David Sommerseth --- packet_id.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'packet_id.c') diff --git a/packet_id.c b/packet_id.c index 024b4f3..ba8973a 100644 --- a/packet_id.c +++ b/packet_id.c @@ -362,9 +362,9 @@ packet_id_persist_load (struct packet_id_persist *p, const char *filename) if (!packet_id_persist_enabled (p)) { /* open packet-id persist file for both read and write */ - p->fd = open (filename, - O_CREAT | O_RDWR | O_BINARY, - S_IRUSR | S_IWUSR); + p->fd = openvpn_open (filename, + O_CREAT | O_RDWR | O_BINARY, + S_IRUSR | S_IWUSR); if (p->fd == -1) { msg (D_PID_PERSIST | M_ERRNO, -- cgit