From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 88178 invoked by alias); 8 Feb 2016 13:15:47 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 88130 invoked by uid 89); 8 Feb 2016 13:15:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-93.9 required=5.0 tests=BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_PBL,RDNS_DYNAMIC,USER_IN_WHITELIST autolearn=no version=3.3.2 spammy=H*R:D*cygwin.com, Wolff, wolff, setlocale X-HELO: calimero.vinschen.de Received: from ipbcc0d020.dynamic.kabel-deutschland.de (HELO calimero.vinschen.de) (188.192.208.32) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 08 Feb 2016 13:15:45 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 168B9A80559; Mon, 8 Feb 2016 14:15:43 +0100 (CET) Date: Mon, 08 Feb 2016 13:15:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: cygwin_conv_ functions and character encoding Message-ID: <20160208131543.GB12975@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <56B4C40A.4060607@towo.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="eAbsdosE1cNLO4uF" Content-Disposition: inline In-Reply-To: <56B4C40A.4060607@towo.net> User-Agent: Mutt/1.5.24 (2015-08-30) X-SW-Source: 2016-02/txt/msg00071.txt.bz2 --eAbsdosE1cNLO4uF Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1976 On Feb 5 16:47, Thomas Wolff wrote: > The cygwin path conversion functions ignore the current locale; > rather they seem to always use the locale environment set when the program > was started, see test program convloc.c: > [...] > In sys_wcstombs in strfuncs.cc I see: > const char *charset =3D cygheap->locale.charset; > which is set in internal_setlocale ()... >=20 > In fact, the situation can be fixed by adding after setlocale(): > cygwin_internal(CW_INT_SETLOCALE); // -> internal_setlocale(); > (cf. https://sourceware.org/ml/cygwin-developers/2010-02/msg00054.html) > but I think those functions should use the proper locale implicitly; > according to the generic description in > http://linux.die.net/man/3/setlocale, > LC_CTYPE affects ... conversion ... functions, in my opinion this would > include cygwin-specific conversion functions as well as implicitly called > conversion (see open() below). > The same problem applies to the open() function (involving path conversio= n). > The wide string function mbstowcs behaves as expected. Path conversion is a problem when switching locales. Typically an application calls setlocale (LC_ALL, "") only and in that case the conversion works as desired. We could switch cygwin_path_conv as you said, but I'm wondering what side-effects that may have. See the comment in internal_setlocale(). > The whole issue occurred to me while trying to work around a missing > conversion functionality, just converting the pathname syntax between > Unicode strings. The desired options would be like: > CCP_POSIX_W_TO_WIN_W, /* from is wchar_t *posix, to is wchar_t *win32 > */ > CCP_WIN_W_TO_POSIX_W, /* from is wchar_t *win32, to is wchar_t *posix > */ Those are not available because POSIX paths are always multibyte strings. Patches welcome, though. Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --eAbsdosE1cNLO4uF Content-Type: application/pgp-signature; name="signature.asc" Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJWuJT+AAoJEPU2Bp2uRE+ggsUP/1fcS22DVI3SfYShqfQPFl3T +PVV/CCMnq5OXw+JMhJEC/YCQNXrqQ1jyFrD8s5CS83hUfpXi3v8eSPumbzamrau JOBI/LQ3KJnesKq7gkhF25tRHEkjpqFqSogGb4xehpN64+G6vjbHkkmFndSS2OS8 XXgC+h0kcsiQ+fFdFm1Byk0vCSsqhOEu8u1WnAHbSJ1TowSxX7rgDCJcdSci7O+W WtLDPt32mqEXXAAU6ogwNO0EKLwuAn+Wmby8wib4DVB2u+9pXxeD+j3HCJV5/qfw yhaNcgYP7F9cMGz7/IAxBPihPRMoJ1heue3jbtt1Xn/SI0Vph2yTsWlZdKcbpMu0 qmFMljmlN3lu9rxcuSHxhnRFls5vzmS9gUAykASN6zH5y+0v/q2dJO1v7wlfSA2v LuEE6Bs7Kx2Eo4kPfC9g94kx0/qCCagaA7iE3ScBDtCDw59gIo7V5h8w2BhAgPTG OZKcCoF6+W78ir0A5aGUJYIwIS6mm0KKLAjJeIbcN1SSEsA5e8yZd1wuUZ7XzT6y +Gn/txpFxkSo7XshMrX8ltXw4GaWL7UPmeTvowSBkwdp+PpmV8xlbUSjhP8aUZJq 1tDd7Q7DEdxoOYLbo70yrnGxCn7ok2TWqHykjMQS71INb0VwL2lAJtKrCY4VCJIQ ONFr9z6afkfmxcOEG9ys =qyzi -----END PGP SIGNATURE----- --eAbsdosE1cNLO4uF--