Page MenuHome GnuPG

Problems with Japansese Win32 Environment
Closed, ResolvedPublic

Description

Environment

Microsoft Windows 2000/XP Japanese version

Description

Japanese (and Chinese, Korean) language has over 30,000 characters.
To use our language on computers, 8bit ascii character sets are not sufficient.
We use double-byte character sets for file names etc..
On double-byte character sets environment, many characters consists of 16bits(=double-byte).

In Japan the most major character set is called Shift-JIS (Japanese Industrial Standards) which is used on MS Windows.
And on Shift-JIS environment some characters have '0x5c' for the second byte. It conflicts with backslash on 8bit ascii code.

So when I use original gnupg on Japanese MS Windows, I sometimes meet errors on finding gnupg configuration files.

How To Repeat

On Japanse MS Windows Environment, put gnupg conf files into a directory which name contains double-byte character whose seconde byte is '0x5c'.
Then execute gpg.exe with '--homedir=' option.

Fix

I made a patch for gnupg-1.4.2 but I don't know if this meets gnupg developers' policy.
Please consider what I want to indicate.

  • gnupg-1.4.2.orig/g10/g10.c 2005-07-23 00:58:08.000000000 +0900
  • gnupg-1.4.2/g10/g10.c 2005-10-20 09:12:51.000000000 +0900 ***
  • 31,36 ****
  • 31,39 ---- #ifdef HAVE_DOSISH_SYSTEM #include <fcntl.h> /* for setmode() */ #endif + #ifdef _WIN32 + #include <windows.h> + #endif #ifdef HAVE_STAT #include <sys/stat.h> /* for stat() */ #endif ***
  • 1742,1749 ****
  • 1745,1762 ---- if ( strchr (opt.homedir,'\\') ) { char *d, *buf = m_alloc (strlen (opt.homedir)+1); const char *s = opt.homedir; + #ifdef _WIN32 + for (d=buf,s=opt.homedir; *s; s++) { + *d++ = *s == '\\'? '/': *s; + if (IsDBCSLeadByte(*s)) { + s++; + *d++ = *s; + } + } + #else for (d=buf,s=opt.homedir; *s; s++) *d++ = *s == '\\'? '/': *s; + #endif *d = 0; set_homedir (buf); }

Event Timeline

Fixed in SVN to be released with gnupg 1.4.3 . Thank you.

We should watch out for this in other projects too.