 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
JMM Guest
|
Posted: Tue Aug 24, 2004 3:16 pm Post subject: Locale problems in 1.4.1_03-b02 |
|
|
I'm having issues dealing with Locale under 1.4.1_03-b02. The problem
seems to be with the Java Runtime having problems reading the system
locale. My system locale is set to UK, but when I run a test program
(code below) I get the date formatted to a US locale instead of UK. I
ran the same program under 1.4.2_03 on win xp, and 1.4.2_04-b05 on
win2k which both worked fine. Running the same program under 1.4.1_03
on win xp and win 2k results in the problem. Does anyone know of a
workaround to this problem without upgrading to 1.4.2_03 or higher?
Also does anyone know what the minimum version we should have if we
did decide to upgrade JRE's?
Thanks,
Jonathan
import java.util.*;
import java.text.*;
public class LocaleTest
{
public static void main(String[] args)
{
DateFormat format = DateFormat.getDateInstanc(DateFormat.SHORT);
format.setCalendar(Calendar.getInstance());
format.getCalendar().set(Calendar.MILLISECOND,0);
format.getCalendar().set(Calendar.SECOND,0);
format.getCalendar().set(Calendar.MINUTE,0);
format.getCalendar().set(Calendar.HOUR,0);
System.out.println("date is "+
format.format(format.getCalendar().getTime()));
}
}
|
|
| Back to top |
|
 |
zoopy Guest
|
Posted: Tue Aug 24, 2004 6:17 pm Post subject: Re: Locale problems in 1.4.1_03-b02 |
|
|
On 24-8-2004 17:16, JMM wrote:
| Quote: | I'm having issues dealing with Locale under 1.4.1_03-b02. The problem
seems to be with the Java Runtime having problems reading the system
locale. My system locale is set to UK, but when I run a test program
(code below) I get the date formatted to a US locale instead of UK. I
ran the same program under 1.4.2_03 on win xp, and 1.4.2_04-b05 on
win2k which both worked fine. Running the same program under 1.4.1_03
on win xp and win 2k results in the problem. Does anyone know of a
workaround to this problem without upgrading to 1.4.2_03 or higher?
|
Start your program with
java -Duser.language=en -Duser.country=GB ...
Note: GB, not UK
| Quote: | Also does anyone know what the minimum version we should have if we
did decide to upgrade JRE's?
|
Don't know, but I'd go for the latest release of 1.4.2 (which is _05 at the time of this writing).
The release notes normally contain a list of bugs that have been fixed by that release.
--
Regards,
Z.
|
|
| Back to top |
|
 |
JMM Guest
|
Posted: Tue Aug 24, 2004 9:54 pm Post subject: Re: Locale problems in 1.4.1_03-b02 |
|
|
zoopy <zoopy (AT) hates (DOT) spam> wrote
| Quote: | On 24-8-2004 17:16, JMM wrote:
I'm having issues dealing with Locale under 1.4.1_03-b02. The problem
seems to be with the Java Runtime having problems reading the system
locale. My system locale is set to UK, but when I run a test program
(code below) I get the date formatted to a US locale instead of UK. I
ran the same program under 1.4.2_03 on win xp, and 1.4.2_04-b05 on
win2k which both worked fine. Running the same program under 1.4.1_03
on win xp and win 2k results in the problem. Does anyone know of a
workaround to this problem without upgrading to 1.4.2_03 or higher?
Start your program with
java -Duser.language=en -Duser.country=GB ...
Note: GB, not UK
Also does anyone know what the minimum version we should have if we
did decide to upgrade JRE's?
Don't know, but I'd go for the latest release of 1.4.2 (which is _05 at the time of this writing).
The release notes normally contain a list of bugs that have been fixed by that release.
[snip]
|
Thanks for the information, but unfortunately I can't upgrade or have
hardcoded command line arguments. The reason is because my users
won't go for the upgrade and they're located all over the world. Do
you know of a workaround that uses the systems locale and the date
formatter will properly use it too?
|
|
| Back to top |
|
 |
zoopy Guest
|
Posted: Wed Aug 25, 2004 9:49 am Post subject: Re: Locale problems in 1.4.1_03-b02 |
|
|
On 24-8-2004 23:54, JMM wrote:
| Quote: | zoopy <zoopy (AT) hates (DOT) spam> wrote
On 24-8-2004 17:16, JMM wrote:
I'm having issues dealing with Locale under 1.4.1_03-b02. The problem
seems to be with the Java Runtime having problems reading the system
locale. My system locale is set to UK, but when I run a test program
(code below) I get the date formatted to a US locale instead of UK. I
ran the same program under 1.4.2_03 on win xp, and 1.4.2_04-b05 on
win2k which both worked fine. Running the same program under 1.4.1_03
on win xp and win 2k results in the problem. Does anyone know of a
workaround to this problem without upgrading to 1.4.2_03 or higher?
Start your program with
java -Duser.language=en -Duser.country=GB ...
Note: GB, not UK
Also does anyone know what the minimum version we should have if we
did decide to upgrade JRE's?
Don't know, but I'd go for the latest release of 1.4.2 (which is _05 at the time of this writing).
The release notes normally contain a list of bugs that have been fixed by that release.
[snip]
Thanks for the information, but unfortunately I can't upgrade or have
hardcoded command line arguments. The reason is because my users
won't go for the upgrade and they're located all over the world. Do
you know of a workaround that uses the systems locale and the date
formatter will properly use it too?
|
There's not much that I can think of, considering these restrictions.
You could check the Java bugdatabase to see if there are workarounds for the problem.
As you probably know, you can programmatically change the default locale (Locale.setDefault(...)),
but that maybe would mean that you have to change your program and have the users upgraded (well,
with new version of your program, not the JRE), a way you seemed no to want to go.
Otherwise you could play around with Window's regional settings, and see if that brings a solution.
Yet, then you would have to instruct every user to change their settings, possibly causing problems
with other applications they have. So, this doesn't seem the proper direction either.
--
Regards,
Z.
|
|
| Back to top |
|
 |
JMM Guest
|
Posted: Wed Aug 25, 2004 2:00 pm Post subject: Re: Locale problems in 1.4.1_03-b02 |
|
|
zoopy <zoopy (AT) hates (DOT) spam> wrote
| Quote: | On 24-8-2004 23:54, JMM wrote:
zoopy <zoopy (AT) hates (DOT) spam> wrote
On 24-8-2004 17:16, JMM wrote:
I'm having issues dealing with Locale under 1.4.1_03-b02. The problem
seems to be with the Java Runtime having problems reading the system
locale. My system locale is set to UK, but when I run a test program
(code below) I get the date formatted to a US locale instead of UK. I
ran the same program under 1.4.2_03 on win xp, and 1.4.2_04-b05 on
win2k which both worked fine. Running the same program under 1.4.1_03
on win xp and win 2k results in the problem. Does anyone know of a
workaround to this problem without upgrading to 1.4.2_03 or higher?
Start your program with
java -Duser.language=en -Duser.country=GB ...
Note: GB, not UK
Also does anyone know what the minimum version we should have if we
did decide to upgrade JRE's?
Don't know, but I'd go for the latest release of 1.4.2 (which is _05 at the time of this writing).
The release notes normally contain a list of bugs that have been fixed by that release.
[snip]
Thanks for the information, but unfortunately I can't upgrade or have
hardcoded command line arguments. The reason is because my users
won't go for the upgrade and they're located all over the world. Do
you know of a workaround that uses the systems locale and the date
formatter will properly use it too?
There's not much that I can think of, considering these restrictions.
You could check the Java bugdatabase to see if there are workarounds for the problem.
As you probably know, you can programmatically change the default locale (Locale.setDefault(...)),
but that maybe would mean that you have to change your program and have the users upgraded (well,
with new version of your program, not the JRE), a way you seemed no to want to go.
Otherwise you could play around with Window's regional settings, and see if that brings a solution.
Yet, then you would have to instruct every user to change their settings, possibly causing problems
with other applications they have. So, this doesn't seem the proper direction either.
|
Thanks again for the update. I realized I was incorrect with the
original issue. It seems that the JRE 1.4.1 does pick up the correct
Locale, but either the DateFormat and/or Calendar classes are ignoring
the Locale. Do you have any suggestions/workarounds in getting the
DateFormat and/or Calendar to acknowledge the correct Locale?
Jonathan
|
|
| Back to top |
|
 |
zoopy Guest
|
Posted: Wed Aug 25, 2004 2:40 pm Post subject: Re: Locale problems in 1.4.1_03-b02 |
|
|
On 25-8-2004 16:00, JMM wrote:
| Quote: | [snip]
Thanks again for the update. I realized I was incorrect with the
original issue. It seems that the JRE 1.4.1 does pick up the correct
Locale, but either the DateFormat and/or Calendar classes are ignoring
the Locale. Do you have any suggestions/workarounds in getting the
DateFormat and/or Calendar to acknowledge the correct Locale?
Jonathan
IIRC there's |
DateFormat.getDateInstance(format,locale)
and
Calender.getInstance(locale)
--
Regards,
Z.
|
|
| Back to top |
|
 |
JMM Guest
|
Posted: Wed Aug 25, 2004 8:45 pm Post subject: Re: Locale problems in 1.4.1_03-b02 |
|
|
zoopy <zoopy (AT) hates (DOT) spam> wrote
| Quote: | On 25-8-2004 16:00, JMM wrote:
[snip]
Thanks again for the update. I realized I was incorrect with the
original issue. It seems that the JRE 1.4.1 does pick up the correct
Locale, but either the DateFormat and/or Calendar classes are ignoring
the Locale. Do you have any suggestions/workarounds in getting the
DateFormat and/or Calendar to acknowledge the correct Locale?
Jonathan
IIRC there's
DateFormat.getDateInstance(format,locale)
and
Calender.getInstance(locale)
|
Thanks for all the assistance. It turns out there wasn't a problem
with any of the classes that I mentioned. The problem was that we're
using the US version of 1.4.1 and not the international version.
Sorry for the mistake.
Jonathan
|
|
| Back to top |
|
 |
zoopy Guest
|
Posted: Thu Aug 26, 2004 6:06 pm Post subject: Re: Locale problems in 1.4.1_03-b02 |
|
|
On 25-8-2004 22:45, JMM wrote:
| Quote: | Thanks for all the assistance. It turns out there wasn't a problem
with any of the classes that I mentioned. The problem was that we're
using the US version of 1.4.1 and not the international version.
|
Yep, that explains a lot...
| Quote: | Sorry for the mistake.
|
Not at all, something to keep in mind for me too
--
Regards,
Z.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|