| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:date:from:to:subject:message-id:reply-to | |
| :references:mime-version:content-type:in-reply-to; q=dns; s= | |
| default; b=ZMvYqF5+vdxy/2XR6nCTCr8EqJ7Cbl0E+qB/zjpu+jl44rkjPBKnp | |
| tCLPZqT6B9YuThlpQooqaBL0+Eft+VF6TAHZ8Tn1TuRxEYNWRrkS+9TppXZcwNXv | |
| CkiJIn813DT9eQ/bIn57kk8uGzhgi60A6T88E4sQ2k+U9rG2Js48Jc= | |
| DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:date:from:to:subject:message-id:reply-to | |
| :references:mime-version:content-type:in-reply-to; s=default; | |
| bh=J30v/LCSmoAcbsrZ11b5c9bQM7U=; b=XWogVeYYc4SIJLEE0PNOvEd4mwZA | |
| VDedjjj9opmcJJZZOoXDi1gNV+nS/Ni4b8wssnSVIdFncyVJ/UrHQzlbPKaLye3g | |
| L31DjrkhMbVgwCkNAY72LIe6LKG5NIPtnbek9dV/OioIOZjGV+i+Kvt+JyCngaWa | |
| cRtxsmhPK5wTV9U= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.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 |
| Authentication-Results: | sourceware.org; auth=none |
| X-Virus-Found: | No |
| X-Spam-SWARE-Status: | No, score=-94.7 required=5.0 tests=BAYES_20,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_PBL,RDNS_DYNAMIC,USER_IN_WHITELIST autolearn=no version=3.3.2 spammy=cook, Cook, H*R:D*cygwin.com, setlocale |
| X-HELO: | calimero.vinschen.de |
| Date: | Mon, 8 Feb 2016 13:37:39 +0100 |
| From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: cygwin 2.4.1: broken ps_AF and ps_AF.utf8 locales |
| Message-ID: | <20160208123739.GA12975@calimero.vinschen.de> |
| Reply-To: | cygwin AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| References: | <20160202043247 DOT GP31193 AT mars DOT tony DOT develop-help DOT com> |
| MIME-Version: | 1.0 |
| In-Reply-To: | <20160202043247.GP31193@mars.tony.develop-help.com> |
| User-Agent: | Mutt/1.5.24 (2015-08-30) |
--J/dobhs11T7y2rNN
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Feb 2 15:32, Tony Cook wrote:
> Hi list,
>=20
> Simplified to a C program below, calls to sprintf() under the ps_AF
> and ps_AF.utf8 locales are returning a value that doesn't match the
> length of the formatted string:
>=20
> tony AT phobos ~
> $ cat ps_AF.c
> #include <stdio.h>
> #include <locale.h>
> #include <string.h>
>=20
> int main(int argc, char **argv) {
> char buf[100];
> char *loc =3D argc > 1 ? argv[1] : "ps_AF";
> const char *real_loc;
> if (!(real_loc =3D setlocale(LC_NUMERIC, loc))) {
> perror("setlocale");
> return 1;
> }
> printf("locale %s\n", real_loc);
> size_t len =3D sprintf(buf, "%g", 2.34);
> printf("len %zu\n", len);
> printf("strlen %zu\n", strlen(buf));
>=20
> return 0;
> }
Thanks for the testcase.
> (and the decimal point under ps_AF on Linux is multi-byte, character
> 0x66b or ARABIC DECIMAL SEPARATOR.)
As on Cygwin. The problem was that Newlib's printf function didn't take
multibyte decimal points into account when computing the field size for
the output. I fixed that in the git repo.
Thanks,
Corinna
--=20
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
--J/dobhs11T7y2rNN
Content-Type: application/pgp-signature; name="signature.asc"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCAAGBQJWuIwTAAoJEPU2Bp2uRE+gan4QAJe0WQAOJDCwTlINsliZqE8q
fJsqC8FbJqKzQFTWlJ6fYKzl08h8F6sWVNlbNvUoqtq7aE8ZVaq2TnR1yK+bQuPu
jDpfPM8+2Gd/aFewIkb5bRq20FtlFVwnuGsXGwFNhfoRmlsu28G6MBmqALmaLIAE
AgnVlc6Bf3o7ezEEwIDSHWT8zSHIrwLyMt4MrbEcdO0TLPFWiqcYGYuCQBkTh+UM
MSbN4/Y0KpoYJQnqh8iwHmPtVpRnKn4LzynbQ8UWr8ni37iw/n2TKs6rb8GS7z3W
ZJIIZ6hLBlmRLzC12nhYBwu5E6O/Nl4auertrjxFdyM/kceQIrG1/1GVmY29TdUs
1H3c05dhBu32aOagiefclceajkAvEB6TO4D6Gd43R1aSUHpEWer2E4v0diPOHXQu
CFuDyGOtK3AS3BdD0CbVe9amxuLJBgk26GPtvgSd1U378SguzedaufnpWnScgq8g
FsBTq8INGBLGJ5zee6JXiKR7p4Qht6Vvfe/qTlQIrb+u6wEGr8Fahpts9W4N6162
g8CqL7iCvcPtJhpP+MEE9ALG5xWy38li2kmc9EL8IGnHL+dvH1PMfk1oBxu5xVwz
1EfOmZN+cxD6KdQRHiKGMm84FirDjAjTMlcf8EIOV//AHww4l6iOkw25L5dUtX6P
rTZ+fVJe8KvXzS94NbM9
=1ISG
-----END PGP SIGNATURE-----
--J/dobhs11T7y2rNN--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |