This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: BUG: Error messages of regtool are wrongly encoded


On May 16 18:15, Fujii Hironori wrote:
> Error messages of regtool can't be read, which are encoded in
> SHIFT_JIS in Japanese Windows.
> 
>  $ regtool get /HKCU/hoge
> Error (2): ▒w▒肳▒▒t▒@▒C▒▒▒▒▒▒▒▒▒▒܂▒▒▒B
> 
>  $ regtool get /HKCU/hoge 2>&1 | iconv -f shift_jis
> Error (2): 指定されたファイルが見つかりません。
> 
> 
> --- regtool.cc.orig 2017-05-16 17:20:32.671229600 +0900
> +++ regtool.cc 2017-05-16 17:21:18.859375500 +0900
> @@ -197,13 +197,13 @@
>  void
>  Fail (unsigned int rv)
>  {
> -  char *buf;
> +  wchar_t *buf;
>    if (!quiet)
>      {
> -      FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER
> +      FormatMessageW (FORMAT_MESSAGE_ALLOCATE_BUFFER
>       | FORMAT_MESSAGE_FROM_SYSTEM,
> -     0, rv, 0, (CHAR *) & buf, 0, 0);
> -      fprintf (stderr, "Error (%d): %s\n", rv, buf);
> +     0, rv, 0, (WCHAR *)& buf, 0, 0);
> +      fprintf (stderr, "Error (%d): %ls\n", rv, buf);
>        LocalFree (buf);
>      }
>    exit (1);

I applied this patch after fixing the formatting.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: signature.asc
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]