RE: [INTERFACES] Spanish format on date and numbers - Mailing list pgsql-interfaces

From Oscar Serrano
Subject RE: [INTERFACES] Spanish format on date and numbers
Date
Msg-id 002801bf3a6b$68d27d40$701d04d5@pep
Whole thread Raw
Responses Re: [INTERFACES] Spanish format on date and numbers
Re: [INTERFACES] Spanish format on date and numbers
List pgsql-interfaces
----- Original Message -----
From: James Olin Oden <joden@lee.k12.nc.us>
To: Oscar Serrano <oserra@fondos.net>
Sent: Sunday, November 28, 1999 7:27 AM
Subject: Re: [INTERFACES] Spanish format on date and numbers


> >
> > This is a multi-part message in MIME format.
> >
> > ------=_NextPart_000_002B_01BF383C.AE4DF100
> > Content-Type: text/plain;
> > charset="iso-8859-1"
> > Content-Transfer-Encoding: quoted-printable
> >
> >
> > Hi:
> > I'm from Spain. I've exported some tables from MS Access to Postgres. =
> > You
> > know, in Spain, a number like this: 1,234.56 me write it like this:
> > 1.234,56
> > i.e., the thousand separator is the "." and the decimal separator is the
=
> > ","
> >
> > I'm going to use Perl (DBI) to get the data from the databases.
> > Is there anyway so DBI or postgress gives me the data in the spanish =
> > format?
> >
> > I wouldn't like to use somethink like this:
> > $result=3D~s/\./,/g;
> > to convert all "." to "," and vice-versa.
> >
> Certainly you can use the substitution operator to replace the .'s with
,'s
> and the ,'s with .'s.  The main problem is that the first substitution you
> make will cause all one character to become the character you are about
> to convert next.  As in:
>
> 1,234.52
>
> becomes:
>
> 1.234.52
>
> when replacing your comma.  So on the next step you have no nice way of
telling
> which is the real . you wish to replace with ,.  One way around this is to
> replace one of the symbols with a third symbol not found in a number:
>
> $result =~ s/\./\@/g; # Periods to @'s
> $result =~ s/\,/\./g; # commas to periods
> $result =~ s/\@/\,/g; # @'s to commas
>
> On the other hand if you don't use the susbstitution operator and instead
> use tr, the translation operator, you can get away with doing it in
> one fell swoop:
>
> $result =~ tr/.,/,./;
>
> and that should do it (-:

I never used the tr (translation operator), but I see that in this case is
better that the =~s
But What I was trying is that postgres returns the values in the spanish
format, not having to translate ,'s to .'s and viceversa

As I told in previos messages, I thing I must compile Postgres
with --use-locale and have defined some variables. But I'm not sure how to
define that variables, and in case I have them well defined, I don't know if
it is needed extra configuration in my Linux, or have installed any spanish
library or whatever.

Thank you very much.



> ...james
> > Thank you very much
> >
> > ______________________________
> >
> > Oscar Serrano
> >
> >
> >
> > ------=_NextPart_000_002B_01BF383C.AE4DF100
> > Content-Type: text/html;
> > charset="iso-8859-1"
> > Content-Transfer-Encoding: quoted-printable
> >
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> > <HTML><HEAD>
> > <META content=3D"text/html; charset=3Diso-8859-1" =
> > http-equiv=3DContent-Type>
> > <META content=3D"MSHTML 5.00.2014.210" name=3DGENERATOR>
> > <STYLE></STYLE>
> > </HEAD>
> > <BODY bgColor=3D#ffffff>
> > <DIV><FONT face=3DArial size=3D2><BR>Hi:<BR>I'm from Spain. I've =
> > exported some=20
> > tables from MS Access to Postgres. You<BR>know, in Spain, a number like
=
> > this:=20
> > 1,234.56 me write it like this:<BR>1.234,56<BR>i.e., the thousand =
> > separator is=20
> > the "." and the decimal separator is the ","</FONT></DIV>
> > <DIV> </DIV>
> > <DIV><FONT face=3DArial size=3D2>I'm going to use Perl (DBI) to get the
=
> > data from=20
> > the databases.<BR>Is there anyway so DBI or postgress gives me the data
=
> > in the=20
> > spanish format?</FONT></DIV>
> > <DIV> </DIV>
> > <DIV><FONT face=3DArial size=3D2>I wouldn't like to use somethink
like=20
> > this:<BR>$result=3D~s/\./,/g;<BR>to convert all "." to "," and=20
> > vice-versa.</FONT></DIV>
> > <DIV> </DIV>
> > <DIV><FONT face=3DArial size=3D2>Thank you very much</FONT></DIV>
> > <DIV> </DIV>
> > <DIV><FONT face=3DArial =
> > size=3D2>______________________________</FONT></DIV>
> > <DIV> </DIV>
> > <DIV><FONT face=3DArial size=3D2>Oscar Serrano</FONT></DIV>
> > <DIV> </DIV>
> > <DIV><FONT face=3DArial size=3D2></FONT> </DIV></BODY></HTML>
> >
> > ------=_NextPart_000_002B_01BF383C.AE4DF100--
> >
> >
> > ************
> >
>



pgsql-interfaces by date:

Previous
From: Enrique Rodriguez Lazaro
Date:
Subject: Problems whit insert from psql
Next
From: "Ross J. Reedstrom"
Date:
Subject: Re: [INTERFACES] pgaccess on win95 connection