GetValue(), floats, and locales - Mailing list pgsql-interfaces

From Jeroen T. Vermeulen
Subject GetValue(), floats, and locales
Date
Msg-id 20030507133633.GD48885@xs4all.nl
Whole thread Raw
Responses Re: GetValue(), floats, and locales  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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



pgsql-interfaces by date:

Previous
From: John Pfersich
Date:
Subject: Re: Linux equivalent of pgadmin
Next
From: "Agrawal, Manish"
Date:
Subject: Re: Linux equivalent of pgadmin