delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/01/04/14:16:20

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <6E7EF003DE3743959BC8EC8F0A6872AA@LeakyCauldron>
References: <6E7EF003DE3743959BC8EC8F0A6872AA AT LeakyCauldron>
Date: Mon, 4 Jan 2010 19:16:10 +0000
Message-ID: <416096c61001041116v72743a17i879979d84a444d01@mail.gmail.com>
Subject: Re: Cygwin 1.7.1 sprintf() with format string having 8th bit set
From: Andy Koppe <andy DOT koppe AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

2010/1/4 Joseph Quinsey:
> 1) In my bad test, I already had my LOCALE set to C.ASCII:
>
> =C2=A0 env | grep LC
> =C2=A0 LC_ALL=3DC.ASCII

To use the locale set in the environment you need to invoke
setlocale(LC_CTYPE, ""), i.e. with an empty string as the second
parameter. Without a setlocale call, your program will use the initial
locale: "C".


> And this setting generates a nuisance
> message "locale not supported by Xlib, locale set to C" whenever I start
> nedit.

Yep, unfortunately X has its own ideas of what valid locales are,
independent of Cygwin's. Therefore you should set a locale with an
actual language, e.g. "en_US.ISO-8859-1". (X probably won't accept the
.ASCII either.)


> And $LANG is ASCII, if this matters.

That's an invalid setting, i.e. it should be in the same
"language.charset" format. But it doesn't matter because LC_ALL takes
priority.


> 2) The call setlocale (LC_CTYPE, "C") did not work, although it returns i=
ts
> second argument.

That's because the "C" locale is what's already selected at program startup.


> 3) The call setlocale (LC_CTYPE, "POSIX") also did not work. It happens to
> return "C".

"POSIX" is just a synonym for "C".


> The above behaviour seems to disagree with the man page.

Which man page?

Andy

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019