Locale problems in 1.4.1_03-b02
8 Message(s) by 2 Author(s) originally posted in java api
| From: jonathanm |
Date: Tuesday, August 24, 2004
|
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've if we
did decide to
upgrade JRE 's?
Thanks,
Jonathanimport 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()));
}
}
| From: zoopy |
Date: Tuesday, August 24, 2004
|
wrote in
message :
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've if we
did decide to upgrade JRE's?
Do not 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]
--
Regards,
Z.
| From: jonathanm |
Date: Tuesday, August 24, 2004
|
wrote in message
wrote in message:
> 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've if we
> did decide to upgrade JRE's?
Do not 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 not 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?
| From: zoopy |
Date: Wednesday, August 25, 2004
|
wrote in message:
wrote in message
wrote in message:
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've if we
did decide to upgrade JRE's?
>Do not 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 not 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'd mean that you've 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've to instruct every user to change their settings, possibly causing problems
with other applications they have. So, this does not seem the proper direction either.
--
Regards,
Z.
| From: jonathanm |
Date: Wednesday, August 25, 2004
|
wrote in message
wrote in message:
wrote in message
>
wrote in message:
>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've if we
>did decide to upgrade JRE's?
>>Do not 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 not 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'd mean that you've 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've to instruct every user to change their settings, possibly causing problems
with other applications they have. So, this does not 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've any suggestions/workarounds in getting the
DateFormat and/or Calendar to acknowledge the correct Locale?
Jonathan
| From: zoopy |
Date: Wednesday, August 25, 2004
|
wrote in message:
> [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've 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.
| From: jonathanm |
Date: Wednesday, August 25, 2004
|
wrote in message
wrote in message:
> [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've 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 was not 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
| From: zoopy |
Date: Thursday, August 26, 2004
|
wrote in message:
Thanks for all the assistance. It turns out there was not 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...
Sorry for the mistake.
Not at all, something to keep in mind for me too ;-)
--
Regards,
Z.
Next Message: COMM API (application programming interface)and PCMCIA