[pmwiki-users] Problem with Google Map API and locale de_DE

Patrick R. Michaud pmichaud at pobox.com
Wed Jun 7 11:44:43 CDT 2006


On Wed, Jun 07, 2006 at 03:43:44PM +0000, Ben Wilson wrote:
> On 6/7/06, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> > On Tue, Jun 06, 2006 at 09:23:02PM +0200, Christian Bartolomaeus wrote:
> > > But as soon as I use
> > >   (: gmap lat=54.09285 lon=13.3785 :)
> > > at least the value of the longitude seems to be ignored or
> > > misinterpreted.
> >
> > The locale setting is causing periods to change to commas.
> > After the call to XLPage(), try restoring the locale back to
> > the standard dot:
> >
> >     XLPage('de', 'PmWikiDe.XLPage');
> >     setlocale(LC_NUMERIC, 'C');
> 
> Hmm. The only "fancy" thing I am doing with lat/lon is calculating the
> center point and outer bounds.[1] 

Yes, but if PHP is set to use a European locale (as happens with de_DE),
then any non-integer numbers that are printed will have commas instead
of periods for the decimal point.

One "fix" is to output the values using printf/sprintf and the %F
conversion, which always uses a '.' for the decimal point.  
Unfortunately, this only works in PHP 4.3.10 and later.

Might also take a look at the number_format() function, which
avoids the locale settings.

Pm




More information about the pmwiki-users mailing list