X-Recipient: archive-cygwin@delorie.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@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.koppe@gmail.com>
To: cygwin@cygwin.com
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.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

