X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Thu, 14 May 2009 22:54:43 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: [1.7] Proposal: the filename encoding in C locale uses UTF-8 instead of SO/UTF-8 Message-ID: <20090514205443.GG21324@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <20090513164526 DOT GO21324 AT calimero DOT vinschen DOT de> <3f0ad08d0905131025j3f9a23c4k8c940dee496ee6fd AT mail DOT gmail DOT com> <20090513174114 DOT GU21324 AT calimero DOT vinschen DOT de> <3f0ad08d0905131213k6c8f1b25h3322f20b5bb80631 AT mail DOT gmail DOT com> <20090513194645 DOT GV21324 AT calimero DOT vinschen DOT de> <3f0ad08d0905140706y3c039ceq707d6a5c79907f21 AT mail DOT gmail DOT com> <20090514144231 DOT GA19217 AT calimero DOT vinschen DOT de> <20090514151249 DOT GD21324 AT calimero DOT vinschen DOT de> <3f0ad08d0905140934s47100629xe89253f0f20445cf AT mail DOT gmail DOT com> <20090514172332 DOT GE21324 AT calimero DOT vinschen DOT de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20090514172332.GE21324@calimero.vinschen.de> User-Agent: Mutt/1.5.19 (2009-02-20) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On May 14 19:23, Corinna Vinschen wrote: > On May 15 01:34, IWAMURO Motonori wrote: > > 2009/5/15 Corinna Vinschen : > > > Here's one problem.  What if an application uses setenv("LANG", ...)? > > > > Oh. Hmmm, I think that anything should not occur. > > > > > Do you want Cygwin to intercept all calls to setenv() to check for > > > setting $LC_ALL/LC_CTYPE/LANG? > > > > No. I think that only setlocale() has to do the check. > > The reason: > > - setlocale(LC_CTYPE, "C") is called from Cygwin startup. > > - The following code become valid. > > setenv("LANG", "..."); > > setlocale(LC_ALL, ""); > > Ok, that makes sense. I'm just testing a patch which use the > environment settings internally as you proposed (still keeping UTF-8 the > default for the "C" locale). So far it works fine, I have just trouble > with SJIS, but that's not something I can easily test. I'm simply > lacking a real understanding of the SJIS encoding. Maybe you can look > into that in the next couple of days? I'll be mostly offline next week > and the week after so there's a lot time for testing ;-) I applied the patch. The charset used by Cygwin now only depends on the last call to setlocale in an application and eventually on the setting of the internationalization environment variables LC_ALL/LC_CTYPE/LANG. A side effect of this change is that the console charset depends solely on the environment setting again. So you can change the console charset used in an application on the fly again by changing the LC_ALL/LC_CTYPE/LANG setting in the environment(*), instead of setting it only once at startup of the first Cygwin process in the console. The (in)famous "ssh to a remote machine from a UTF-8 console doesn't work" problem(**) should be unaffected by this change and still work now, if, for instance, LANG is set to "en_US.UTF-8" in the calling shell. Just the documentation needs to be updated again. I really hope this change makes it finally easier to use Cygwin with native characters. I'll create a new Cygwin package tomorrow. Corinna (*) Still depends on a call to setlocale, but the Cygwin shells do that anyway. (**) http://cygwin.com/ml/cygwin/2009-04/msg00055.html -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/