delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/02/08/08:16:04

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=AdNMG3a9gKT2wBWX21qG+wyDIKLyjZ5n/I7ZgGKjqb3qSFiyup1FU
0DB1Ug8wZK0EipLF/PtyQRffOG+KvhaFbdW+aSvsH97sqKDH8nSwzfwBYJXwPTgm
ZjvIGaqwse6NjJ1yoCvTt096JbLtzSRZmI8M5fPElUyL8cUMYBhy+8=
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=lYWis4zXuhhWgl11UPbMAtDnXyE=; b=QuzXbsiyi6qq+d94X0VXgGWBFoBV
moHOf+OrVG3tuNffrCNGFSSbRD57kI2Q8oDmkpwhC1wnK8bpWSfnBui9Fe/DiN+f
joQlo/L9l2pKuYGTXdZfwz2ppuwtIqjHoTN+OZ/H4a/ig4waIrxLCmYcAFGWjhkW
Bk3Obcvzu8hGaH8=
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=-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
Date: Mon, 8 Feb 2016 14:15:43 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: cygwin_conv_ functions and character encoding
Message-ID: <20160208131543.GB12975@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <56B4C40A DOT 4060607 AT towo DOT net>
MIME-Version: 1.0
In-Reply-To: <56B4C40A.4060607@towo.net>
User-Agent: Mutt/1.5.24 (2015-08-30)

--eAbsdosE1cNLO4uF
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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"

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

- Raw text -


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