X-Original-To: pgsql-interfaces@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4952A475D0F for ; Wed, 7 May 2003 09:36:59 -0400 (EDT) Received: from mxzilla2.xs4all.nl (mxzilla2.xs4all.nl [194.109.6.50]) by postgresql.org (Postfix) with ESMTP id 0251E474E42 for ; Wed, 7 May 2003 09:36:31 -0400 (EDT) Received: from xs1.xs4all.nl (xs1.xs4all.nl [194.109.3.11]) by mxzilla2.xs4all.nl (8.12.3/8.12.3) with ESMTP id h47DaXPU001269 for ; Wed, 7 May 2003 15:36:34 +0200 (CEST) Received: from xs1.xs4all.nl (jtv@localhost.xs4all.nl [127.0.0.1]) by xs1.xs4all.nl (8.12.9/8.11.6) with ESMTP id h47DaXrR073044 for ; Wed, 7 May 2003 15:36:33 +0200 (CEST) (envelope-from jtv@xs1.xs4all.nl) Received: (from Unknown UID 8109@localhost) by xs1.xs4all.nl (8.12.9/8.12.8/Submit) id h47DaXsI073036 for pgsql-interfaces@postgresql.org; Wed, 7 May 2003 15:36:33 +0200 (CEST) (envelope-from jtv) Date: Wed, 7 May 2003 15:36:33 +0200 From: "Jeroen T. Vermeulen" To: pgsql-interfaces@postgresql.org Subject: GetValue(), floats, and locales Message-ID: <20030507133633.GD48885@xs4all.nl> Mail-Followup-To: pgsql-interfaces@postgresql.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-Spam-Status: No, hits=-12.1 required=5.0 tests=BAYES_10,USER_AGENT_MUTT autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/17 X-Sequence-Number: 4135 I just got a bothersome bug report from a libpqxx user in Hungary (where, as it turns out, floating-point numbers are written with decimal commas rather than decimal points). It appears that libpq's GetValue() delivers floating-point fields in localized format. The problem with this is that libpqxx then tries to parse the numbers using sscanf(), which apparently doesn't expect the number to have a decimal comma. This begs the question: is it libpq that represents these values using the client's locale, or does the server ship them in this form according to its own locale? The former is fine but really needs (1) some standard way to parse the localized numbers, or (2) a bypass to the more parsable C-style representation. The latter would be just plain crazy AFAICS. Jeroen