Re: Weird Problem w/ DecimalFormat

From: Andy Fish (ajfish_at_blueyonder.co.uk)
Date: 05/11/04


Date: Tue, 11 May 2004 09:21:08 GMT


"Thomas Weidenfeller" <nobody@ericsson.invalid> wrote in message
news:c7q002$fvf$1@newstree.wise.edt.ericsson.se...
> Cliff wrote:
> > The following code snippet:
> >
> > static DecimalFormat nf=new DecimalFormat("#####.00");
> > System.out.println(nf.format(1000.10));
> >
> > sometimes stops working properly
>
> Sounds like it works as advertised.
>
> > and instead of seeing 1000.10 I see 1000,10
> > (note the comma). I can't for the life of me figure out what is going
on...
> > I'm using Java 1.3.1 on a Sun workstation.
>
> Check the settings of your locale (LANG and LC_ environment variables,
> etc.). Not everyone in the world uses the '.' as the decimal delimiter.

I think you need to define "sometimes". I would be very surprised if it
behaves this way intermittently in a consistent environment. Once you have
figured out the difference in environment you have the answer.

Often these kind of things work one way when you run it in the development
environment or when loggged on interactively, but a different way when you
install it in the services control panel (NT), or have it run as an rc
script (*x)

>
> /Thomas



Relevant Pages

  • Re: display unicode db text in visual C++ mfc ide 2003
    ... The active input locale will be in ENglish in OS-XP environment. ... 80% of your application us Unicode. ...
    (microsoft.public.vc.mfc)
  • Re: 8-bit characters anyone?
    ... What does the following in one of your shells? ... In KDE I have configured the locale as Swedish, ... environment in the login shell or my ``.xinitrc'' file. ... % Identifier "Keyboard0" ...
    (freebsd-questions)
  • Re: How to change external-format in SBCL (c-string encoding error)
    ... the lisp process), so by the time user code gets to run, it is too ... late to change anything in the area that depends on locale. ... a rather different environment from user processes, ...
    (comp.lang.lisp)
  • Re: LC_NUMERIC in Windows
    ... bottom) environment variables. ... el # greek locale: this variable is set by windows on installation ... gawk is the version I compiled with msys/mingw32 tools and nawk is ... Kernighan's awk compiled with the same compiler. ...
    (comp.lang.awk)
  • Re: strcoll() function.
    ... argument instead of as an environment? ... which might have different collation configurations? ... the locale back to the default at some point with another call to setlocale. ...
    (comp.lang.c)