public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* BUG: Error messages of regtool are wrongly encoded
@ 2017-05-16 10:52 Fujii Hironori
  2017-06-06 16:48 ` Corinna Vinschen
  2017-06-20 11:19 ` Corinna Vinschen
  0 siblings, 2 replies; 3+ messages in thread
From: Fujii Hironori @ 2017-05-16 10:52 UTC (permalink / raw)
  To: cygwin

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);

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: BUG: Error messages of regtool are wrongly encoded
  2017-05-16 10:52 BUG: Error messages of regtool are wrongly encoded Fujii Hironori
@ 2017-06-06 16:48 ` Corinna Vinschen
  2017-06-20 11:19 ` Corinna Vinschen
  1 sibling, 0 replies; 3+ messages in thread
From: Corinna Vinschen @ 2017-06-06 16:48 UTC (permalink / raw)
  To: Fujii Hironori; +Cc: cygwin

[-- Attachment #1: Type: text/plain, Size: 1364 bytes --]

Hi Fujii,

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);

Unfortunately this patch doesn't apply cleanly.  Any chance you can
create a patch with `git format-patch' and send that as attachment?


Thanks,
Corinna

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: BUG: Error messages of regtool are wrongly encoded
  2017-05-16 10:52 BUG: Error messages of regtool are wrongly encoded Fujii Hironori
  2017-06-06 16:48 ` Corinna Vinschen
@ 2017-06-20 11:19 ` Corinna Vinschen
  1 sibling, 0 replies; 3+ messages in thread
From: Corinna Vinschen @ 2017-06-20 11:19 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1264 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-20 11:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-16 10:52 BUG: Error messages of regtool are wrongly encoded Fujii Hironori
2017-06-06 16:48 ` Corinna Vinschen
2017-06-20 11:19 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).