From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Newsgroups: gmane.lisp.guile.bugs Subject: bug#35920: strftime incorrectly assumes that nstrftime will produce UTF-8 Date: Tue, 02 Jul 2019 11:07:01 +0200 Message-ID: <87imskajpm.fsf@gnu.org> References: <877ebt7tc0.fsf@netris.org> <87tvew4efa.fsf@netris.org> <875zrb3ydk.fsf@netris.org> <871s1z3tbq.fsf@netris.org> <87v9xxq767.fsf_-_@netris.org> <87muj9q6nk.fsf@netris.org> <87imtwrint.fsf@netris.org> <874l46svg1.fsf@gnu.org> <87blyekcaa.fsf@netris.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="145838"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) Cc: 35920@debbugs.gnu.org, Christopher Lam To: Mark H Weaver Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue Jul 02 11:08:10 2019 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hiElm-000blM-5Y for guile-bugs@m.gmane.org; Tue, 02 Jul 2019 11:08:10 +0200 Original-Received: from localhost ([::1]:50906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hiElk-0004vR-S5 for guile-bugs@m.gmane.org; Tue, 02 Jul 2019 05:08:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33100) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hiElf-0004s1-AF for bug-guile@gnu.org; Tue, 02 Jul 2019 05:08:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hiEle-0001pV-80 for bug-guile@gnu.org; Tue, 02 Jul 2019 05:08:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37741) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hiEle-0001pM-3V for bug-guile@gnu.org; Tue, 02 Jul 2019 05:08:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hiEld-0004vK-RY for bug-guile@gnu.org; Tue, 02 Jul 2019 05:08:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 02 Jul 2019 09:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35920 X-GNU-PR-Package: guile Original-Received: via spool by 35920-submit@debbugs.gnu.org id=B35920.156205843118864 (code B ref 35920); Tue, 02 Jul 2019 09:08:01 +0000 Original-Received: (at 35920) by debbugs.gnu.org; 2 Jul 2019 09:07:11 +0000 Original-Received: from localhost ([127.0.0.1]:46562 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hiEkp-0004uC-0e for submit@debbugs.gnu.org; Tue, 02 Jul 2019 05:07:11 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:48821) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hiEkn-0004tz-I7 for 35920@debbugs.gnu.org; Tue, 02 Jul 2019 05:07:09 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:45143) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hiEki-0000hP-63; Tue, 02 Jul 2019 05:07:04 -0400 Original-Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=50390 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hiEkh-0006hb-MM; Tue, 02 Jul 2019 05:07:03 -0400 X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 14 Messidor an 227 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu In-Reply-To: <87blyekcaa.fsf@netris.org> (Mark H. Weaver's message of "Sun, 30 Jun 2019 17:12:45 -0400") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:9386 Archived-At: Hi Mark, Mark H Weaver skribis: >> Mark H Weaver skribis: >> >>> Here's a patch that might fix the problem, but I don't have time to test >>> it right now. >> >> It works! :-) I wrote tests and pushed it as >> ab2fd70ef1e36c6532128b73082809ef3c056556. > > On my system, I found that my proposed patch caused one of the existing > tests to fail. Which test? In commit ab2fd70ef1e36c6532128b73082809ef3c056556 I modified the test that passes \u0100 to run in a UTF-8 locale, on the grounds that the previous behavior was fragile: =E2=80=9Craw bytes=E2=80=9D= of the input string would be preserved, but they could be mixed with things like month names in the current locale encoding. The result is rather unpredictable. > The problem is that if the format string includes characters that are > not representable in the current locale encoding, it will fail. It > seems to me that this could break existing code that currently works. > User code that uses 'strftime' might never encode the resulting string > in the locale encoding. In theory yes, but I cannot think of a scenario where the previous behavior would be =E2=80=9Cuseful=E2=80=9D, because it=E2=80=99s hard to ev= en describe what it means. > I was planning to rewrite the code to scan for the '%' escapes > ourselves, to call 'strftime' for each escape sequence (without > including the surrounding text), and to concatenate the results. I think we should deprecate =E2=80=98strftime=E2=80=99 and =E2=80=98strptim= e=E2=80=99: (srfi srfi-19) provides similar functionality, it uses (ice-9 i18n) for the locale stuff, and it has a better API. Perhaps something we can do in 3.0? Thanks, Ludo=E2=80=99.