From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.bugs Subject: bug#24990: Wrong formatted output with 'number->locale-string' Date: Mon, 13 Feb 2017 00:24:00 +0100 Message-ID: <87k28vq9gv.fsf@gnu.org> References: <20161122214801.GA20536@remote.famic.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1486941911 6967 195.159.176.226 (12 Feb 2017 23:25:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 12 Feb 2017 23:25:11 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: Vladimir Zhbanov , 24990-done@debbugs.gnu.org To: Martin Michel Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Mon Feb 13 00:25:07 2017 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cd3Vy-0001TA-5n for guile-bugs@m.gmane.org; Mon, 13 Feb 2017 00:25:06 +0100 Original-Received: from localhost ([::1]:53796 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cd3W3-0004q5-Vs for guile-bugs@m.gmane.org; Sun, 12 Feb 2017 18:25:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39462) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cd3Vx-0004nM-Ch for bug-guile@gnu.org; Sun, 12 Feb 2017 18:25:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cd3Vu-0005Fd-6z for bug-guile@gnu.org; Sun, 12 Feb 2017 18:25:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39335) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cd3Vu-0005FV-48 for bug-guile@gnu.org; Sun, 12 Feb 2017 18:25:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cd3Vt-0003rs-WE for bug-guile@gnu.org; Sun, 12 Feb 2017 18:25:02 -0500 Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: "Debbugs-submit" Resent-To: bug-guile@gnu.org Resent-Date: Sun, 12 Feb 2017 23:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 24990 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Mail-Followup-To: 24990@debbugs.gnu.org, ludo@gnu.org, dev@famic.de Original-Received: via spool by 24990-done@debbugs.gnu.org id=D24990.148694185814809 (code D ref 24990); Sun, 12 Feb 2017 23:25:01 +0000 Original-Received: (at 24990-done) by debbugs.gnu.org; 12 Feb 2017 23:24:18 +0000 Original-Received: from localhost ([127.0.0.1]:37533 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cd3VB-0003qn-PZ for submit@debbugs.gnu.org; Sun, 12 Feb 2017 18:24:18 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:48383) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cd3VA-0003qa-MW for 24990-done@debbugs.gnu.org; Sun, 12 Feb 2017 18:24:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cd3V4-00055D-DF for 24990-done@debbugs.gnu.org; Sun, 12 Feb 2017 18:24:11 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:51583) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cd3Uy-000546-6e; Sun, 12 Feb 2017 18:24:04 -0500 Original-Received: from reverse-83.fdn.fr ([80.67.176.83]:55908 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cd3Ux-0005E7-Fp; Sun, 12 Feb 2017 18:24:03 -0500 In-Reply-To: <20161122214801.GA20536@remote.famic.de> (Martin Michel's message of "Tue, 22 Nov 2016 22:48:01 +0100") 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: 208.118.235.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:8541 Archived-At: Hi, Martin Michel skribis: > From: Vladimir Zhbanov > Subject: Re: Formatted output with locale > To: dev@famic.de, 24990@debbugs.gnu.org > Date: Mon, 14 Nov 2016 09:03:19 +0300 (12 weeks, 6 days, 15 hours ago) > > Hi Martin, > > On 11/13/16, dev@famic.de wrote: >> Hi there, >> I have problems to get a proper formatting using the (ice-9 format) >> module. In my code, I need to deal with monetary figures, but I fail >> to get the correct format for my German locale. >> Let's say I have one hundred thousand Euros. The correct format to output >> this in de_DE.utf-8 would be >> 100.000,00 EUR >> (with 2 decimals) >> >> Now I tried: >> (setlocale LC_ALL "de_DE.UTF-8") >> (use-modules (ice-9 format)) >> (define a 100000.00) >> (format #t "~12,2h EUR~%" a) >> (format #t "~,,12$ EUR~%" a) >> (format #t "~12,2f EUR~%" a) >> >> But this is what Guile gives to me: >> 100.000,0 EUR >> 100000.00 EUR >> 100000.00 EUR >> >> None is correct. What did I miss? >> -Martin > > Looking at the `format' code for option `h' I see the procedure > `number->locale-string' is used. > > OK, let's do some experiments: > > scheme@(guile-user)> (setlocale LC_ALL) > $2 =3D "ru_RU.UTF-8" > scheme@(guile-user)> ,use (ice-9 i18n) > scheme@(guile-user)> (number->locale-string 10.0 5) > $3 =3D "10,0" > scheme@(guile-user)> (number->locale-string .00003 2) > $4 =3D "3,0e" > scheme@(guile-user)> (number->locale-string .00003 1) > $5 =3D "3,0" > scheme@(guile-user)> (number->locale-string .00003 3) > $6 =3D "3,0e-" > scheme@(guile-user)> (number->locale-string .0 3) > $7 =3D "-0,0" > scheme@(guile-user)> (number->locale-string .0 10) > $8 =3D "-0,0" > scheme@(guile-user)> (number->locale-string .0 1) > $9 =3D "-0,0" > > Now for the procedure monetary-amount->locale-string: > > scheme@(guile-user)> (monetary-amount->locale-string .0 #t) > $10 =3D "-0.0 RUB " > scheme@(guile-user)> (monetary-amount->locale-string 100000.0 #t) > $11 =3D "100\xa0000.0 RUB " > scheme@(guile-user)> (monetary-amount->locale-string .00003 #t) > $12 =3D "3.0e RUB " I believe these are fixed by commit 4aead68cdb86ca60cc372f0cd558cadda90ddec5. You=E2=80=99re welcome to do more testing and report back! Thanks, Ludo=E2=80=99.