From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25507 invoked by alias); 2 Apr 2019 20:57:52 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 25486 invoked by uid 89); 2 Apr 2019 20:57:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: =?ISO-8859-1?Q?No, score=-0.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,FROM_EXCESS_BASE64,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.1 spammy==d0=b2=d1, LANGUAGE, env, intl?= X-HELO: mail-ua1-f44.google.com Received: from mail-ua1-f44.google.com (HELO mail-ua1-f44.google.com) (209.85.222.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 02 Apr 2019 20:57:50 +0000 Received: by mail-ua1-f44.google.com with SMTP id v7so4866640uak.13 for ; Tue, 02 Apr 2019 13:57:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=7MpAPaDThtj4WTcXQ0hru6MIMdkRtba6yfaxkp8m+W4=; b=Gz+n82MpO3lkP+HoHj4gctSIPwi4USz15rDilRvF3i4mDy7fg4mDNzcwYsVrpa2Ykm un5/TNxF42jxvgTOUs6nJYOyUSXxXquXEQNSf9p3o7qNpRv3UQicfmtWBEhRN8SfGMKe 7uq31Rqcr5GwB8F08A7Xjr2hE0Lj9chMfiAEAptZW14TveUlprtA0I2S9Nka0coSbRK5 NLBb+Rsq0gLlMUzFQo5bD3q0wmAM9cYMsqxMXPqZV39cp9sGNzAlPvvU5j0qWGJBtbEL /wNd1RplH470b6WeGP5xYpXTyolRshGfH+eZyqgkT9qG1dAv7BKq9TkBxydEMrjYKxix /Y1w== MIME-Version: 1.0 References: <83mullpwg6.fsf@gnu.org> <83ef6qjdbb.fsf@gnu.org> <838swyjafd.fsf@gnu.org> <837echkgjo.fsf@gnu.org> <8336n3hzkx.fsf@gnu.org> <7041169d-9f64-fcce-2c3c-021dd1858923@dronecode.org.uk> In-Reply-To: <7041169d-9f64-fcce-2c3c-021dd1858923@dronecode.org.uk> From: =?UTF-8?B?0JLQu9Cw0LTQuNC80LjRgCDQnNCw0YDRgtGM0Y/QvdC+0LI=?= Date: Tue, 02 Apr 2019 20:57:00 -0000 Message-ID: Subject: Re: [PATCH][PR server/24377] Fix mixing English and system default languages in error messages on Windows To: Jon Turney Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-SW-Source: 2019-04/txt/msg00010.txt.bz2 =D0=B2=D1=82, 2 =D0=B0=D0=BF=D1=80. 2019 =D0=B3. =D0=B2 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=D1=81e 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=3Den_US /cygdrive/c/Programming/Test/Debug/test.exe C $ LC_ALL=3Dde_DE /cygdrive/c/Programming/Test/Debug/test.exe C Changing env. var doesn't affect setlocale() result.