From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jason Rumney Newsgroups: gmane.emacs.bugs Subject: Re: Display problem on Windows with time zones containing Non-ASCII characters. Date: Wed, 06 Jun 2007 00:48:31 +0100 Message-ID: <4665F64F.70501@gnu.org> References: <4665D5B9.2050300@gmx.de> <4665F2A5.9060802@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1181087330 16350 80.91.229.12 (5 Jun 2007 23:48:50 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 5 Jun 2007 23:48:50 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org, Michael Schierl To: Kenichi Handa Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jun 06 01:48:49 2007 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Hvilc-0006Hx-Vo for geb-bug-gnu-emacs@m.gmane.org; Wed, 06 Jun 2007 01:48:49 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hvilc-0005kF-Ic for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 Jun 2007 19:48:48 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Hvilb-0005k9-2V for bug-gnu-emacs@gnu.org; Tue, 05 Jun 2007 19:48:47 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Hvila-0005jx-En for bug-gnu-emacs@gnu.org; Tue, 05 Jun 2007 19:48:46 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hvila-0005ju-9I for bug-gnu-emacs@gnu.org; Tue, 05 Jun 2007 19:48:46 -0400 Original-Received: from outmail1.freedom2surf.net ([194.106.33.237]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HvilZ-0007EE-Q5 for bug-gnu-emacs@gnu.org; Tue, 05 Jun 2007 19:48:46 -0400 Original-Received: from [127.0.0.1] (i-83-67-23-108.freedom2surf.net [83.67.23.108]) by outmail1.freedom2surf.net (Postfix) with ESMTP id B10175076F; Wed, 6 Jun 2007 00:48:44 +0100 (BST) User-Agent: Thunderbird 2.0.0.0 (Windows/20070326) In-Reply-To: <4665F2A5.9060802@gnu.org> X-detected-kernel: Linux 2.4-2.6 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:15764 Archived-At: Jason Rumney wrote: > So the same bug must have been reported in the past for the Japanese > locale on W32, but we covered it over by rejecting non alphanumeric > timezone names rather than fixing the bug by decoding them using > locale_coding_system. I think the following change should fix the problem. Can anyone more familiar with the coding functions confirm that I am doing this correctly. Some of the calls to code_convert_string_norecord use make_unibyte_string rather than build_string, but I can't figure out when it is appropriate to do one not the other - or are they equivalent? *** editfns.c 09 May 2007 10:32:39 +0100 1.439.2.1 --- editfns.c 06 Jun 2007 00:42:04 +0100 *************** *** 1974,1979 **** --- 1974,1981 ---- int offset = tm_diff (t, &gmt); char *s = 0; char buf[6]; + Lisp_Object name; + #ifdef HAVE_TM_ZONE if (t->tm_zone) s = (char *)t->tm_zone; *************** *** 1984,2002 **** #endif #endif /* not HAVE_TM_ZONE */ - #if defined HAVE_TM_ZONE || defined HAVE_TZNAME - if (s) - { - /* On Japanese w32, we can get a Japanese string as time - zone name. Don't accept that. */ - char *p; - for (p = s; *p && (isalnum ((unsigned char)*p) || *p == ' '); ++p) - ; - if (p == s || *p) - s = NULL; - } - #endif - if (!s) { /* No local time zone name is available; use "+-NNNN" instead. */ --- 1986,1991 ---- *************** *** 2004,2010 **** sprintf (buf, "%c%02d%02d", (offset < 0 ? '-' : '+'), am/60, am%60); s = buf; } ! return Fcons (make_number (offset), Fcons (build_string (s), Qnil)); } else return Fmake_list (make_number (2), Qnil); --- 1993,2002 ---- sprintf (buf, "%c%02d%02d", (offset < 0 ? '-' : '+'), am/60, am%60); s = buf; } ! name = code_convert_string_norecord (build_string (s), ! Vlocale_coding_system, 0); ! ! return Fcons (make_number (offset), name, Qnil)); } else return Fmake_list (make_number (2), Qnil);