GNU bug report logs - #35920
strftime incorrectly assumes that nstrftime will produce UTF-8

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guile; Reported by: Mark H Weaver <mhw@HIDDEN>; dated Sun, 26 May 2019 20:45:02 UTC; Maintainer for guile is bug-guile@HIDDEN.
Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs@HIDDEN> to internal_control <at> debbugs.gnu.org. Full text available.

Message received at 35920 <at> debbugs.gnu.org:


Received: (at 35920) by debbugs.gnu.org; 30 Jun 2019 21:13:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 30 17:13:10 2019
Received: from localhost ([127.0.0.1]:47390 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hhh8H-0006fu-Pk
	for submit <at> debbugs.gnu.org; Sun, 30 Jun 2019 17:13:09 -0400
Received: from world.peace.net ([64.112.178.59]:55378)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mhw@HIDDEN>)
 id 1hhh8F-0006f2-MY; Sun, 30 Jun 2019 17:13:08 -0400
Received: from mhw by world.peace.net with esmtpsa
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89)
 (envelope-from <mhw@HIDDEN>)
 id 1hhh89-0000uE-5o; Sun, 30 Jun 2019 17:13:01 -0400
From: Mark H Weaver <mhw@HIDDEN>
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Subject: Re: bug#35920: strftime incorrectly assumes that nstrftime will
 produce UTF-8
In-Reply-To: <874l46svg1.fsf@HIDDEN>
References: <CAKVAZZKGeVMxtMsONgmM6dVkT2UZuCmNQrXFmrDkb9_TvW_Yeg@HIDDEN>
 <877ebt7tc0.fsf@HIDDEN>
 <CAKVAZZLTL1+AJCkQ0t8VbdS=39BxLG5=T7TD+C0_2_7-kPuY0g@HIDDEN>
 <87tvew4efa.fsf@HIDDEN>
 <CAKVAZZ+v9kFaAUxeJ5_opNSnmwJONT+wW14R38AHGpnwqEfuGA@HIDDEN>
 <875zrb3ydk.fsf@HIDDEN> <871s1z3tbq.fsf@HIDDEN>
 <CAKVAZZLQ628QAfYffmOQ3Q4j9hzBck7nzh0BHSEshEU0sRQpOA@HIDDEN>
 <CAKVAZZJP1veiMKYqpvZTZG2g6LO=_O-ovzouzEJ-T-mQUsOzYQ@HIDDEN>
 <CAKVAZZJ0v1-snrRQj0CAxFikKDy+Xf_FWxHXV4tVJ1mVrnY8ig@HIDDEN>
 <87v9xxq767.fsf_-_@HIDDEN> <87muj9q6nk.fsf@HIDDEN>
 <87imtwrint.fsf@HIDDEN> <874l46svg1.fsf@HIDDEN>
Date: Sun, 30 Jun 2019 17:12:45 -0400
Message-ID: <87blyekcaa.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35920
Cc: 35920 <at> debbugs.gnu.org, Christopher Lam <christopher.lck@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

reopen 35920
thanks

Hi Ludovic,

> Mark H Weaver <mhw@HIDDEN> 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.  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.

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 forgot to change the commit author to you before pushing, apologies!

No worries.  Thanks for working on it.

      Mark




Information forwarded to bug-guile@HIDDEN:
bug#35920; Package guile. Full text available.

Message received at 35920-done <at> debbugs.gnu.org:


Received: (at 35920-done) by debbugs.gnu.org; 30 Jun 2019 19:51:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 30 15:51:52 2019
Received: from localhost ([127.0.0.1]:47323 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hhfrc-0004aE-Fn
	for submit <at> debbugs.gnu.org; Sun, 30 Jun 2019 15:51:52 -0400
Received: from eggs.gnu.org ([209.51.188.92]:48698)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1hhfra-0004ZX-2F
 for 35920-done <at> debbugs.gnu.org; Sun, 30 Jun 2019 15:51:50 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:37841)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <ludo@HIDDEN>)
 id 1hhfrU-0005Sj-J4; Sun, 30 Jun 2019 15:51:44 -0400
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=40010 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1hhfrU-000168-4K; Sun, 30 Jun 2019 15:51:44 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Mark H Weaver <mhw@HIDDEN>
Subject: Re: bug#35920: strftime incorrectly assumes that nstrftime will
 produce UTF-8
References: <CAKVAZZKGeVMxtMsONgmM6dVkT2UZuCmNQrXFmrDkb9_TvW_Yeg@HIDDEN>
 <877ebt7tc0.fsf@HIDDEN>
 <CAKVAZZLTL1+AJCkQ0t8VbdS=39BxLG5=T7TD+C0_2_7-kPuY0g@HIDDEN>
 <87tvew4efa.fsf@HIDDEN>
 <CAKVAZZ+v9kFaAUxeJ5_opNSnmwJONT+wW14R38AHGpnwqEfuGA@HIDDEN>
 <875zrb3ydk.fsf@HIDDEN> <871s1z3tbq.fsf@HIDDEN>
 <CAKVAZZLQ628QAfYffmOQ3Q4j9hzBck7nzh0BHSEshEU0sRQpOA@HIDDEN>
 <CAKVAZZJP1veiMKYqpvZTZG2g6LO=_O-ovzouzEJ-T-mQUsOzYQ@HIDDEN>
 <CAKVAZZJ0v1-snrRQj0CAxFikKDy+Xf_FWxHXV4tVJ1mVrnY8ig@HIDDEN>
 <87v9xxq767.fsf_-_@HIDDEN> <87muj9q6nk.fsf@HIDDEN>
 <87imtwrint.fsf@HIDDEN>
Date: Sun, 30 Jun 2019 21:51:42 +0200
In-Reply-To: <87imtwrint.fsf@HIDDEN> (Mark H. Weaver's message of "Sun, 26
 May 2019 17:48:27 -0400")
Message-ID: <874l46svg1.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 35920-done
Cc: 35920-done <at> debbugs.gnu.org, Christopher Lam <christopher.lck@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi Mark,

Mark H Weaver <mhw@HIDDEN> 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.

I forgot to change the commit author to you before pushing, apologies!

Thanks,
Ludo=E2=80=99.




Notification sent to Mark H Weaver <mhw@HIDDEN>:
bug acknowledged by developer. Full text available.
Reply sent to Ludovic Courtès <ludo@HIDDEN>:
You have taken responsibility. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 27 May 2019 00:29:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 26 20:29:54 2019
Received: from localhost ([127.0.0.1]:52192 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hV3WT-0002Gs-TE
	for submit <at> debbugs.gnu.org; Sun, 26 May 2019 20:29:54 -0400
Received: from eggs.gnu.org ([209.51.188.92]:33991)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <christopher.lck@HIDDEN>) id 1hV38O-0001am-Sx
 for submit <at> debbugs.gnu.org; Sun, 26 May 2019 20:05:01 -0400
Received: from lists.gnu.org ([209.51.188.17]:46558)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <christopher.lck@HIDDEN>)
 id 1hV38J-0005pL-RA
 for submit <at> debbugs.gnu.org; Sun, 26 May 2019 20:04:55 -0400
Received: from eggs.gnu.org ([209.51.188.92]:48373)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <christopher.lck@HIDDEN>) id 1hV38I-0003UZ-Me
 for bug-guile@HIDDEN; Sun, 26 May 2019 20:04:55 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 HTML_MESSAGE,URIBL_BLOCKED autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <christopher.lck@HIDDEN>) id 1hV38H-0005oK-Ib
 for bug-guile@HIDDEN; Sun, 26 May 2019 20:04:54 -0400
Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]:33592)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <christopher.lck@HIDDEN>)
 id 1hV38H-0005nR-BI
 for bug-guile@HIDDEN; Sun, 26 May 2019 20:04:53 -0400
Received: by mail-ed1-x531.google.com with SMTP id n17so24021019edb.0
 for <bug-guile@HIDDEN>; Sun, 26 May 2019 17:04:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=7ae3WpF2b3mO0GO/rJ+oR0QNGx3MPn7M0UDfrvJEOm4=;
 b=R0HfeeMrhhAE25kvOtURwZht4kNcG4aEMs3SFWvemRPcQBaqkyXO2QGQjOOXzjdhb9
 H06E3I0vGB0qRFUO7Mj7MgR2Vi/DU3Mxx6Fn6/vAJ/8w8AM/KnbCov9MkSLgQ+UX0e+I
 qpQKwW31sVZJJhIDjp22g0pW7CsHqAMfwRi+y6a2TG9d7Ge6JtwxYDHF2miC4AoytSmf
 fVknf1p6AXNM9ciGVJcj/6UxqxX4ORuHJF5TBr9HsOmNuwMNv39P4Fqu5PpJsl5uJdap
 raqky8YGprRDKOOlgaEoHmFW4+BmjCYJ0v7M0X9d7NU6e8cLi9rvjk+3crL0+hJX1R2r
 sH1A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=7ae3WpF2b3mO0GO/rJ+oR0QNGx3MPn7M0UDfrvJEOm4=;
 b=YvZJjWyklAbzGbqS9VQLIp3Ak4UsRNNwGkjA8su/XdMYb45l/gPAyUSiyRxEuogJ6/
 2J+nPSoIl7K1mCzftJy7t+DPofJhYiVyPwfvQMaFC/vDohOK3Rkk8eUDY6h+/cUmlhmH
 o76zldY6McBwEj6lrg1CMQ3gRXfwguklPmWuC3Q2TQzaLfGWo445oeiDKD3+TdugBe+e
 jAuhEQHjkH0gEdIVyV48pJFoYy/6VRUzOtPpTQIPRWZNRGp5VAJD3vh9gC6/VJ7mgSQZ
 rntcg82jhu2ocR4s096plh7xGMj4TUQ9hYbUiqIKxaBNdCHIQYeJdOKGPTpGoNFiYNow
 8X/g==
X-Gm-Message-State: APjAAAWqeJiq0bnNhSFr5FR9FHe5cL6FgWKATw8+PloMGP1UT4/svr9l
 ZqBtO25TQcvhWyZkFkdgih7iNb1s3pZZUnzJwCg=
X-Google-Smtp-Source: APXvYqwSKPfbiZo3nCklOJHc1HthESvvRcfhgkixl4hT8C4YJ/jRQ9x4ThYImhiBS1H71oZC9hJ6MxjkbLoWM/4U+Jk=
X-Received: by 2002:a17:906:31d4:: with SMTP id
 f20mr52550650ejf.275.1558915490802; 
 Sun, 26 May 2019 17:04:50 -0700 (PDT)
MIME-Version: 1.0
References: <CAKVAZZKGeVMxtMsONgmM6dVkT2UZuCmNQrXFmrDkb9_TvW_Yeg@HIDDEN>
 <877ebt7tc0.fsf@HIDDEN>
 <CAKVAZZLTL1+AJCkQ0t8VbdS=39BxLG5=T7TD+C0_2_7-kPuY0g@HIDDEN>
 <87tvew4efa.fsf@HIDDEN>
 <CAKVAZZ+v9kFaAUxeJ5_opNSnmwJONT+wW14R38AHGpnwqEfuGA@HIDDEN>
 <875zrb3ydk.fsf@HIDDEN> <871s1z3tbq.fsf@HIDDEN>
 <CAKVAZZLQ628QAfYffmOQ3Q4j9hzBck7nzh0BHSEshEU0sRQpOA@HIDDEN>
 <CAKVAZZJP1veiMKYqpvZTZG2g6LO=_O-ovzouzEJ-T-mQUsOzYQ@HIDDEN>
 <CAKVAZZJ0v1-snrRQj0CAxFikKDy+Xf_FWxHXV4tVJ1mVrnY8ig@HIDDEN>
 <87v9xxq767.fsf_-_@HIDDEN>
In-Reply-To: <87v9xxq767.fsf_-_@HIDDEN>
From: Christopher Lam <christopher.lck@HIDDEN>
Date: Mon, 27 May 2019 10:04:39 +1000
Message-ID: <CAKVAZZ+EvfAfb+A09UoLeuwpO-HaP5=2Ls=9-bfCF=_k3bT2Xg@HIDDEN>
Subject: Re: strftime incorrectly assumes that nstrftime will produce UTF-8
To: Mark H Weaver <mhw@HIDDEN>
Content-Type: multipart/alternative; boundary="00000000000010720a0589d34c1e"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::531
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sun, 26 May 2019 20:29:52 -0400
Cc: bug-guile@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--00000000000010720a0589d34c1e
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Thanks! I'm glad to know this. I have adequate fluency in guile now but
very basic C hence some bugs are very opaque to me.

On Mon., 27 May 2019, 04:43 Mark H Weaver, <mhw@HIDDEN> wrote:

> Hi Christopher,
>
> Christopher Lam <christopher.lck@HIDDEN> writes:
>
> > Addendum - wish to confirm if guile bug (guile-2.2 on Windows):
> > - set locale to non-Anglo so that (setlocale LC_ALL) returns
> > "French_France.1252"
> > - call (strftime "%B" 4000000) - that's 4x10^6 -- this should return
> > "f=C3=A9vrier 1970"
> >
> > but the following error arises:
> > Throw to key `decoding-error' with args `("scm_from_utf8_stringn" "inpu=
t
> > locale conversion error" 0 #vu8(102 233 118 114 105 101 114 32 49 57 55
> > 48))'.
> >
> > Is this a bug?
>
> Yes.  Guile's 'strftime' procedure currently assumes that the underlying
> 'nstrftime' C function (from Gnulib) will produce output in UTF-8,
> although it almost certainly produces output in the locale encoding.
> Indeed, the bytevector #vu8(102 233 118 114 105 101 114 32 49 57 55 48)
> represents the characters "f=C3=A9vrier 1970" in Windows-1252 encoding.
>
> I'm CC'ing this reply to <bug-guile@HIDDEN>, so that a bug ticket will
> be created.  In the future, that's the preferred address for sending bug
> reports.
>
> Anyway, thanks for letting us know about this.  I'll work on it soon.
>
>       Mark
>

--00000000000010720a0589d34c1e
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">Thanks! I&#39;m glad to know this. I have adequate fluenc=
y in guile now but very basic C hence some bugs are very opaque to me.</div=
><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Mo=
n., 27 May 2019, 04:43 Mark H Weaver, &lt;<a href=3D"mailto:mhw@HIDDEN"=
>mhw@HIDDEN</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" s=
tyle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi C=
hristopher,<br>
<br>
Christopher Lam &lt;<a href=3D"mailto:christopher.lck@HIDDEN" target=3D"=
_blank" rel=3D"noreferrer">christopher.lck@HIDDEN</a>&gt; writes:<br>
<br>
&gt; Addendum - wish to confirm if guile bug (guile-2.2 on Windows):<br>
&gt; - set locale to non-Anglo so that (setlocale LC_ALL) returns<br>
&gt; &quot;French_France.1252&quot;<br>
&gt; - call (strftime &quot;%B&quot; 4000000) - that&#39;s 4x10^6 -- this s=
hould return<br>
&gt; &quot;f=C3=A9vrier 1970&quot;<br>
&gt;<br>
&gt; but the following error arises:<br>
&gt; Throw to key `decoding-error&#39; with args `(&quot;scm_from_utf8_stri=
ngn&quot; &quot;input<br>
&gt; locale conversion error&quot; 0 #vu8(102 233 118 114 105 101 114 32 49=
 57 55<br>
&gt; 48))&#39;.<br>
&gt;<br>
&gt; Is this a bug?<br>
<br>
Yes.=C2=A0 Guile&#39;s &#39;strftime&#39; procedure currently assumes that =
the underlying<br>
&#39;nstrftime&#39; C function (from Gnulib) will produce output in UTF-8,<=
br>
although it almost certainly produces output in the locale encoding.<br>
Indeed, the bytevector #vu8(102 233 118 114 105 101 114 32 49 57 55 48)<br>
represents the characters &quot;f=C3=A9vrier 1970&quot; in Windows-1252 enc=
oding.<br>
<br>
I&#39;m CC&#39;ing this reply to &lt;<a href=3D"mailto:bug-guile@HIDDEN" t=
arget=3D"_blank" rel=3D"noreferrer">bug-guile@HIDDEN</a>&gt;, so that a bu=
g ticket will<br>
be created.=C2=A0 In the future, that&#39;s the preferred address for sendi=
ng bug<br>
reports.<br>
<br>
Anyway, thanks for letting us know about this.=C2=A0 I&#39;ll work on it so=
on.<br>
<br>
=C2=A0 =C2=A0 =C2=A0 Mark<br>
</blockquote></div>

--00000000000010720a0589d34c1e--




Information forwarded to bug-guile@HIDDEN:
bug#35920; Package guile. Full text available.

Message received at 35920 <at> debbugs.gnu.org:


Received: (at 35920) by debbugs.gnu.org; 26 May 2019 21:50:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 26 17:50:28 2019
Received: from localhost ([127.0.0.1]:51999 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hV12C-0006VD-Cw
	for submit <at> debbugs.gnu.org; Sun, 26 May 2019 17:50:28 -0400
Received: from world.peace.net ([64.112.178.59]:58144)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mhw@HIDDEN>) id 1hV12B-0006Uy-6N
 for 35920 <at> debbugs.gnu.org; Sun, 26 May 2019 17:50:27 -0400
Received: from mhw by world.peace.net with esmtpsa
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89)
 (envelope-from <mhw@HIDDEN>)
 id 1hV125-000105-1J; Sun, 26 May 2019 17:50:21 -0400
From: Mark H Weaver <mhw@HIDDEN>
To: Christopher Lam <christopher.lck@HIDDEN>
Subject: Re: bug#35920: strftime incorrectly assumes that nstrftime will
 produce UTF-8
References: <CAKVAZZKGeVMxtMsONgmM6dVkT2UZuCmNQrXFmrDkb9_TvW_Yeg@HIDDEN>
 <877ebt7tc0.fsf@HIDDEN>
 <CAKVAZZLTL1+AJCkQ0t8VbdS=39BxLG5=T7TD+C0_2_7-kPuY0g@HIDDEN>
 <87tvew4efa.fsf@HIDDEN>
 <CAKVAZZ+v9kFaAUxeJ5_opNSnmwJONT+wW14R38AHGpnwqEfuGA@HIDDEN>
 <875zrb3ydk.fsf@HIDDEN> <871s1z3tbq.fsf@HIDDEN>
 <CAKVAZZLQ628QAfYffmOQ3Q4j9hzBck7nzh0BHSEshEU0sRQpOA@HIDDEN>
 <CAKVAZZJP1veiMKYqpvZTZG2g6LO=_O-ovzouzEJ-T-mQUsOzYQ@HIDDEN>
 <CAKVAZZJ0v1-snrRQj0CAxFikKDy+Xf_FWxHXV4tVJ1mVrnY8ig@HIDDEN>
 <87v9xxq767.fsf_-_@HIDDEN> <87muj9q6nk.fsf@HIDDEN>
Date: Sun, 26 May 2019 17:48:27 -0400
In-Reply-To: <87muj9q6nk.fsf@HIDDEN> (Mark H. Weaver's message of "Sun, 26
 May 2019 16:53:08 -0400")
Message-ID: <87imtwrint.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35920
Cc: 35920 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Here's a patch that might fix the problem, but I don't have time to test
it right now.

       Mark


--8<---------------cut here---------------start------------->8---
diff --git a/libguile/stime.c b/libguile/stime.c
index b681d7ee3..9a21b61fe 100644
--- a/libguile/stime.c
+++ b/libguile/stime.c
@@ -662,9 +662,9 @@ SCM_DEFINE (scm_strftime, "strftime", 2, 0, 0,
   SCM_VALIDATE_STRING (1, format);
   bdtime2c (stime, &t, SCM_ARG2, FUNC_NAME);
 
-  /* Convert string to UTF-8 so that non-ASCII characters in the
-     format are passed through unchanged.  */
-  fmt = scm_to_utf8_stringn (format, &len);
+  /* Convert the format string to the locale encoding, as the underlying
+     'strftime' C function expects.  */
+  fmt = scm_to_locale_stringn (format, &len);
 
   /* Ugly hack: strftime can return 0 if its buffer is too small,
      but some valid time strings (e.g. "%p") can sometimes produce
@@ -727,7 +727,7 @@ SCM_DEFINE (scm_strftime, "strftime", 2, 0, 0,
 #endif
     }
 
-  result = scm_from_utf8_string (tbuf + 1);
+  result = scm_from_locale_string (tbuf + 1);
   free (tbuf);
   free (myfmt);
 #if HAVE_STRUCT_TM_TM_ZONE
@@ -754,16 +754,16 @@ SCM_DEFINE (scm_strptime, "strptime", 2, 0, 0,
 {
   struct tm t;
   char *fmt, *str, *rest;
-  size_t used_len;
+  SCM used_len;
   long zoff;
 
   SCM_VALIDATE_STRING (1, format);
   SCM_VALIDATE_STRING (2, string);
 
-  /* Convert strings to UTF-8 so that non-ASCII characters are passed
-     through unchanged.  */
-  fmt = scm_to_utf8_string (format);
-  str = scm_to_utf8_string (string);
+  /* Convert strings to the locale encoding, as the underlying
+     'strptime' C function expects.  */
+  fmt = scm_to_locale_string (format);
+  str = scm_to_locale_string (string);
 
   /* initialize the struct tm */
 #define tm_init(field) t.field = 0
@@ -807,14 +807,14 @@ SCM_DEFINE (scm_strptime, "strptime", 2, 0, 0,
   zoff = 0;
 #endif
 
-  /* Compute the number of UTF-8 characters.  */
-  used_len = u8_strnlen ((scm_t_uint8*) str, rest-str);
+  /* Compute the number of characters parsed.  */
+  used_len = scm_string_length (scm_from_locale_stringn (str, rest-str));
   scm_remember_upto_here_2 (format, string);
   free (str);
   free (fmt);
 
   return scm_cons (filltime (&t, zoff, NULL),
-		   scm_from_signed_integer (used_len));
+                   used_len);
 }
 #undef FUNC_NAME
 #endif /* HAVE_STRPTIME */
--8<---------------cut here---------------end--------------->8---




Information forwarded to bug-guile@HIDDEN:
bug#35920; Package guile. Full text available.

Message received at 35920 <at> debbugs.gnu.org:


Received: (at 35920) by debbugs.gnu.org; 26 May 2019 20:55:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 26 16:55:10 2019
Received: from localhost ([127.0.0.1]:51898 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hV0Ag-00056m-76
	for submit <at> debbugs.gnu.org; Sun, 26 May 2019 16:55:10 -0400
Received: from world.peace.net ([64.112.178.59]:58088)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mhw@HIDDEN>) id 1hV0Ad-00056M-1g
 for 35920 <at> debbugs.gnu.org; Sun, 26 May 2019 16:55:07 -0400
Received: from mhw by world.peace.net with esmtpsa
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89)
 (envelope-from <mhw@HIDDEN>)
 id 1hV0AX-0000SM-9g; Sun, 26 May 2019 16:55:01 -0400
From: Mark H Weaver <mhw@HIDDEN>
To: Christopher Lam <christopher.lck@HIDDEN>
Subject: Re: bug#35920: strftime incorrectly assumes that nstrftime will
 produce UTF-8
References: <CAKVAZZKGeVMxtMsONgmM6dVkT2UZuCmNQrXFmrDkb9_TvW_Yeg@HIDDEN>
 <877ebt7tc0.fsf@HIDDEN>
 <CAKVAZZLTL1+AJCkQ0t8VbdS=39BxLG5=T7TD+C0_2_7-kPuY0g@HIDDEN>
 <87tvew4efa.fsf@HIDDEN>
 <CAKVAZZ+v9kFaAUxeJ5_opNSnmwJONT+wW14R38AHGpnwqEfuGA@HIDDEN>
 <875zrb3ydk.fsf@HIDDEN> <871s1z3tbq.fsf@HIDDEN>
 <CAKVAZZLQ628QAfYffmOQ3Q4j9hzBck7nzh0BHSEshEU0sRQpOA@HIDDEN>
 <CAKVAZZJP1veiMKYqpvZTZG2g6LO=_O-ovzouzEJ-T-mQUsOzYQ@HIDDEN>
 <CAKVAZZJ0v1-snrRQj0CAxFikKDy+Xf_FWxHXV4tVJ1mVrnY8ig@HIDDEN>
 <87v9xxq767.fsf_-_@HIDDEN>
Date: Sun, 26 May 2019 16:53:08 -0400
In-Reply-To: <87v9xxq767.fsf_-_@HIDDEN> (Mark H. Weaver's message of "Sun, 
 26 May 2019 16:41:57 -0400")
Message-ID: <87muj9q6nk.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35920
Cc: 35920 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

There might also be related problems with 'strptime'.  These problems
date back to when Guile was first extended to support non-ASCII strings.
Here's the relevant commit in 2009 that added non-ASCII support to
'strftime' and 'strptime', but did so imperfectly:
587a33556fdef90025c1b7d4d172af649c8ebba8

       Mark




Information forwarded to bug-guile@HIDDEN:
bug#35920; Package guile. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 26 May 2019 20:44:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 26 16:44:23 2019
Received: from localhost ([127.0.0.1]:51886 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hV00F-0004mV-3y
	for submit <at> debbugs.gnu.org; Sun, 26 May 2019 16:44:23 -0400
Received: from eggs.gnu.org ([209.51.188.92]:37212)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mhw@HIDDEN>) id 1hV00E-0004mJ-0v
 for submit <at> debbugs.gnu.org; Sun, 26 May 2019 16:44:22 -0400
Received: from lists.gnu.org ([209.51.188.17]:52656)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <mhw@HIDDEN>) id 1hV008-0001n3-09
 for submit <at> debbugs.gnu.org; Sun, 26 May 2019 16:44:16 -0400
Received: from eggs.gnu.org ([209.51.188.92]:51575)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mhw@HIDDEN>) id 1hV004-0003mr-RH
 for bug-guile@HIDDEN; Sun, 26 May 2019 16:44:15 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <mhw@HIDDEN>) id 1hUzzx-0001aX-KY
 for bug-guile@HIDDEN; Sun, 26 May 2019 16:44:11 -0400
Received: from world.peace.net ([64.112.178.59]:39876)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <mhw@HIDDEN>) id 1hUzzw-0001Qk-TE
 for bug-guile@HIDDEN; Sun, 26 May 2019 16:44:04 -0400
Received: from mhw by world.peace.net with esmtpsa
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89)
 (envelope-from <mhw@HIDDEN>)
 id 1hUzzj-0000L8-QU; Sun, 26 May 2019 16:43:51 -0400
From: Mark H Weaver <mhw@HIDDEN>
To: Christopher Lam <christopher.lck@HIDDEN>
Subject: strftime incorrectly assumes that nstrftime will produce UTF-8
References: <CAKVAZZKGeVMxtMsONgmM6dVkT2UZuCmNQrXFmrDkb9_TvW_Yeg@HIDDEN>
 <877ebt7tc0.fsf@HIDDEN>
 <CAKVAZZLTL1+AJCkQ0t8VbdS=39BxLG5=T7TD+C0_2_7-kPuY0g@HIDDEN>
 <87tvew4efa.fsf@HIDDEN>
 <CAKVAZZ+v9kFaAUxeJ5_opNSnmwJONT+wW14R38AHGpnwqEfuGA@HIDDEN>
 <875zrb3ydk.fsf@HIDDEN> <871s1z3tbq.fsf@HIDDEN>
 <CAKVAZZLQ628QAfYffmOQ3Q4j9hzBck7nzh0BHSEshEU0sRQpOA@HIDDEN>
 <CAKVAZZJP1veiMKYqpvZTZG2g6LO=_O-ovzouzEJ-T-mQUsOzYQ@HIDDEN>
 <CAKVAZZJ0v1-snrRQj0CAxFikKDy+Xf_FWxHXV4tVJ1mVrnY8ig@HIDDEN>
Date: Sun, 26 May 2019 16:41:57 -0400
In-Reply-To: <CAKVAZZJ0v1-snrRQj0CAxFikKDy+Xf_FWxHXV4tVJ1mVrnY8ig@HIDDEN>
 (Christopher Lam's message of "Sun, 26 May 2019 18:52:16 +0800")
Message-ID: <87v9xxq767.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 64.112.178.59
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: bug-guile@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Hi Christopher,

Christopher Lam <christopher.lck@HIDDEN> writes:

> Addendum - wish to confirm if guile bug (guile-2.2 on Windows):
> - set locale to non-Anglo so that (setlocale LC_ALL) returns
> "French_France.1252"
> - call (strftime "%B" 4000000) - that's 4x10^6 -- this should return
> "f=C3=A9vrier 1970"
>
> but the following error arises:
> Throw to key `decoding-error' with args `("scm_from_utf8_stringn" "input
> locale conversion error" 0 #vu8(102 233 118 114 105 101 114 32 49 57 55
> 48))'.
>
> Is this a bug?

Yes.  Guile's 'strftime' procedure currently assumes that the underlying
'nstrftime' C function (from Gnulib) will produce output in UTF-8,
although it almost certainly produces output in the locale encoding.
Indeed, the bytevector #vu8(102 233 118 114 105 101 114 32 49 57 55 48)
represents the characters "f=C3=A9vrier 1970" in Windows-1252 encoding.

I'm CC'ing this reply to <bug-guile@HIDDEN>, so that a bug ticket will
be created.  In the future, that's the preferred address for sending bug
reports.

Anyway, thanks for letting us know about this.  I'll work on it soon.

      Mark




Acknowledgement sent to Mark H Weaver <mhw@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guile@HIDDEN. Full text available.
Report forwarded to bug-guile@HIDDEN:
bug#35920; Package guile. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 30 Jun 2019 21:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.