Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Владимир Мартьянов" <vilgeforce@gmail.com>
To: Jon Turney <jon.turney@dronecode.org.uk>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH][PR server/24377] Fix mixing English and system default languages in error messages on Windows
Date: Tue, 02 Apr 2019 20:57:00 -0000	[thread overview]
Message-ID: <CAL5iTP+tOSGjidKxfwpg7StqKxYOWJd6bVRoqQSUxPerxn=vRQ@mail.gmail.com> (raw)
In-Reply-To: <7041169d-9f64-fcce-2c3c-021dd1858923@dronecode.org.uk>

вт, 2 апр. 2019 г. в 01:08, Jon Turney <jon.turney@dronecode.org.uk>:
>
> I'm wondering why this problem doesn't crop up in gdb itself?  Are there
> no uses of FormatMessage() in that?

FormatMessage is used in gdb/gdb-dlfcn.c, gdb/common/mingw-strerror.c,
gdb/gdbserver/gdbreplay.c and in gdb/gdbserver/win32-low.c. If I
passed a dummy file name to gdb "gdb.exe foo" it shows me a
non-WIndows message "No such file or directory". I think it's from
libiberty.

> A few comments on your get_lcid() function:
>
> - It looks like this is going to ignore LC_ALL etc. if LocaleNameToLCID
> and Rfc1766ToLcidW can't found.  This doesn't seem correct as the
> environment variable should still have an effect.

it will be just the current behaviour - to use system default locale
in FormatMessage.

> - You're not checking all the environment variables which might control
> the locale for the message locale category (See e.g. [1]). I don't think
> there's any need to do this by hand, since you should be able to use the
> result of setlocale(LC_MESSAGE, NULL)?

Yes, you are right, I missed "LANGUAGE" var because it's in another
file in /intl/
Wish I had a function for this. _nl_locale_name from intl/localename.c
looks good,but it doesn't read LANGUAGE var and I have errors when
include intl/gettextP.h

I'm able to use results from setlocale(), but how can the user
influenсe the result of setlocale?
I wrote i simple program to display it's result:
void main(int argc, char* argv[])
{
    printf("%s\n", setlocale(LC_ALL, 0));
}
Then I run it from Cygwin console:
$ LC_ALL=en_US /cygdrive/c/Programming/Test/Debug/test.exe
C
$ LC_ALL=de_DE /cygdrive/c/Programming/Test/Debug/test.exe
C

Changing env. var doesn't affect setlocale() result.


  reply	other threads:[~2019-04-02 20:57 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-23 11:59 Владимир Мартьянов
2019-03-23 13:11 ` Eli Zaretskii
2019-03-28 20:36   ` Владимир Мартьянов
2019-03-29  8:27     ` Eli Zaretskii
2019-03-29  8:42       ` Владимир Мартьянов
2019-03-29  9:29         ` Eli Zaretskii
2019-03-29  9:39           ` Владимир Мартьянов
2019-03-29 12:32             ` Eli Zaretskii
2019-03-30 21:26               ` Владимир Мартьянов
2019-03-31 14:45                 ` Eli Zaretskii
2019-03-31 19:39                   ` Владимир Мартьянов
2019-04-01  4:47                     ` Eli Zaretskii
2019-04-02 20:08                       ` Владимир Мартьянов
2019-04-03  4:30                         ` Eli Zaretskii
2019-04-01 22:08                     ` Jon Turney
2019-04-02 20:57                       ` Владимир Мартьянов [this message]
2019-04-02 21:10                         ` Jon Turney
2019-04-02 21:18                           ` Владимир Мартьянов
2019-04-03  4:48                         ` Eli Zaretskii
2019-04-03  4:58                           ` LRN
2019-04-03  7:37                             ` Eli Zaretskii
2019-04-03 11:32                               ` LRN
2019-04-03 12:04                                 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAL5iTP+tOSGjidKxfwpg7StqKxYOWJd6bVRoqQSUxPerxn=vRQ@mail.gmail.com' \
    --to=vilgeforce@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jon.turney@dronecode.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox