One of our developers here is experimenting with Java SDK "1.3.0-C" on
WindowsNT has encountered what appears to be an incomplete Java
localization issue. Can you pass the following along to your development
folks to see if they concur that this is a bug?
Here is my observation on the Double.parseDouble(String) method.
I am using the latest jdk1.3 final release. It apparently shows that Sun's
implementation of Double does not accept a String which is in the France locale.
The source is attached.
richard.baxter@east 2000-06-30
recent customer feed back is:
From the java2doc that came with Java SDK "1.3.0-C" on WindowsNT ,
Double.parseDouble makes use of the 'valueOf' method to perform its
function. It seems unlikely that, 'valueOf' is going to take into account
localization issues and know to replace a US locale separator '.' with a
French local separator of ','.
Further, when we look at Java Source code for Double.parseDouble(), it uses
'FloatingDecimal.readJavaFormatString(s).doubleValue();' The implementation
for readJavaFormatString is hard-coded to look for a decimal value as a
separator (see line 1033).
Finally, when we do use the workaround, localization fails. Here is sample
code and the result....
import java.util.*;
import java.text.*;
public class Test {
public static void main(String[] args)
{
String doubleStr = "12,34";
// Get the default locale
Locale l = Locale.getDefault();
try {
double d = Double.valueOf(doubleStr).doubleValue();
} catch (NumberFormatException e) {
e.printStackTrace();
System.out.println("The number parsed is: " + doubleStr);
System.out.println("Default locale is: " + l);
}
}
}
Here is the result:
U:\>java Test
java.lang.NumberFormatException: 12,34
at java.lang.FloatingDecimal.readJavaFormatString(Unknown Source)
at java.lang.Double.valueOf(Unknown Source)
at Test.main(Test.java:11)
The number parsed is: 12,34
Default locale is: fr_FR
WindowsNT has encountered what appears to be an incomplete Java
localization issue. Can you pass the following along to your development
folks to see if they concur that this is a bug?
Here is my observation on the Double.parseDouble(String) method.
I am using the latest jdk1.3 final release. It apparently shows that Sun's
implementation of Double does not accept a String which is in the France locale.
The source is attached.
richard.baxter@east 2000-06-30
recent customer feed back is:
From the java2doc that came with Java SDK "1.3.0-C" on WindowsNT ,
Double.parseDouble makes use of the 'valueOf' method to perform its
function. It seems unlikely that, 'valueOf' is going to take into account
localization issues and know to replace a US locale separator '.' with a
French local separator of ','.
Further, when we look at Java Source code for Double.parseDouble(), it uses
'FloatingDecimal.readJavaFormatString(s).doubleValue();' The implementation
for readJavaFormatString is hard-coded to look for a decimal value as a
separator (see line 1033).
Finally, when we do use the workaround, localization fails. Here is sample
code and the result....
import java.util.*;
import java.text.*;
public class Test {
public static void main(String[] args)
{
String doubleStr = "12,34";
// Get the default locale
Locale l = Locale.getDefault();
try {
double d = Double.valueOf(doubleStr).doubleValue();
} catch (NumberFormatException e) {
e.printStackTrace();
System.out.println("The number parsed is: " + doubleStr);
System.out.println("Default locale is: " + l);
}
}
}
Here is the result:
U:\>java Test
java.lang.NumberFormatException: 12,34
at java.lang.FloatingDecimal.readJavaFormatString(Unknown Source)
at java.lang.Double.valueOf(Unknown Source)
at Test.main(Test.java:11)
The number parsed is: 12,34
Default locale is: fr_FR
- relates to
-
JDK-4449157 Float.parseFloat() method is not Internationalized
-
- Closed
-
-
JDK-4253785 java.lang.Double needs a parseDouble(string) method
-
- Closed
-
[Fmt-Nu] Java SDK "1.3.0-C" localization issue with Double.parseDouble(String) method
One of our developers here is experimenting with Java SDK "1.3.0-C" on
WindowsNT has encountered what appears to be an incomplete Java
localization issue. Can you pass the following along to your development
folks to see if they concur that this is a bug?
Here is my observation on the Double.parseDouble(String) method.
I am using the latest jdk1.3 final release. It apparently shows that Sun's
implementation of Double does not accept a String which is in the France locale.
The source is attached.
richard.baxter@east 2000-06-30
recent customer feed back is:
From the java2doc that came with Java SDK "1.3.0-C" on WindowsNT ,
Double.parseDouble makes use of the 'valueOf' method to perform its
function. It seems unlikely that, 'valueOf' is going to take into account
localization issues and know to replace a US locale separator '.' with a
French local separator of ','.
Further, when we look at Java Source code for Double.parseDouble(), it uses
'FloatingDecimal.readJavaFormatString(s).doubleValue();' The implementation
for readJavaFormatString is hard-coded to look for a decimal value as a
separator (see line 1033).
Finally, when we do use the workaround, localization fails. Here is sample
code and the result....
import java.util.*;
import java.text.*;
public class Test {
public static void main(String[] args)
{
String doubleStr = "12,34";
// Get the default locale
Locale l = Locale.getDefault();
try {
double d = Double.valueOf(doubleStr).doubleValue();
} catch (NumberFormatException e) {
e.printStackTrace();
System.out.println("The number parsed is: " + doubleStr);
System.out.println("Default locale is: " + l);
}
}
}
Here is the result:
U:\>java Test
java.lang.NumberFormatException: 12,34
at java.lang.FloatingDecimal.readJavaFormatString(Unknown Source)
at java.lang.Double.valueOf(Unknown Source)
at Test.main(Test.java:11)
The number parsed is: 12,34
Default locale is: fr_FR
WindowsNT has encountered what appears to be an incomplete Java
localization issue. Can you pass the following along to your development
folks to see if they concur that this is a bug?
Here is my observation on the Double.parseDouble(String) method.
I am using the latest jdk1.3 final release. It apparently shows that Sun's
implementation of Double does not accept a String which is in the France locale.
The source is attached.
richard.baxter@east 2000-06-30
recent customer feed back is:
From the java2doc that came with Java SDK "1.3.0-C" on WindowsNT ,
Double.parseDouble makes use of the 'valueOf' method to perform its
function. It seems unlikely that, 'valueOf' is going to take into account
localization issues and know to replace a US locale separator '.' with a
French local separator of ','.
Further, when we look at Java Source code for Double.parseDouble(), it uses
'FloatingDecimal.readJavaFormatString(s).doubleValue();' The implementation
for readJavaFormatString is hard-coded to look for a decimal value as a
separator (see line 1033).
Finally, when we do use the workaround, localization fails. Here is sample
code and the result....
import java.util.*;
import java.text.*;
public class Test {
public static void main(String[] args)
{
String doubleStr = "12,34";
// Get the default locale
Locale l = Locale.getDefault();
try {
double d = Double.valueOf(doubleStr).doubleValue();
} catch (NumberFormatException e) {
e.printStackTrace();
System.out.println("The number parsed is: " + doubleStr);
System.out.println("Default locale is: " + l);
}
}
}
Here is the result:
U:\>java Test
java.lang.NumberFormatException: 12,34
at java.lang.FloatingDecimal.readJavaFormatString(Unknown Source)
at java.lang.Double.valueOf(Unknown Source)
at Test.main(Test.java:11)
The number parsed is: 12,34
Default locale is: fr_FR
- relates to
-
JDK-4449157 Float.parseFloat() method is not Internationalized
-
- Closed
-
-
JDK-4253785 java.lang.Double needs a parseDouble(string) method
-
- Closed
-