GetValue(), floats, and locales

From: "Jeroen T(dot) Vermeulen" <jtv(at)xs4all(dot)nl>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: GetValue(), floats, and locales
Date: 2003-05-07 13:36:33
Message-ID: 20030507133633.GD48885@xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

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

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Agrawal, Manish 2003-05-07 15:29:43 Re: Linux equivalent of pgadmin
Previous Message John Pfersich 2003-05-07 01:58:52 Re: Linux equivalent of pgadmin