-
Bug
-
Resolution: Won't Fix
-
P5
-
None
-
1.1.8
-
x86
-
windows_nt
Name: krT82822 Date: 05/03/99
Background:
If Windows NT's file system encounters a file with illegal characters (eg, \ / etc) it converts the illegal chars to 0xF0xx. . .
[reflects correction vs. original, based on later user comment: "I said the characters are 0xFFxx, but they're actually 0xF0xx."]
Files with illegal characters can be generated on the Mac.
Somewhere in the Java encoding, these special characters get converted to '?' (0x3F). This makes it impossible to open the file with an
InputStream or Reader object...
Code:
This application just uses a FileDialog to select a file. It then tries to open it with a FileReader which will fail with a FileNotFoundException.
You'll need to create a file with illegal chars yourself.
import java.awt.*;
import java.io.*;
public class TrivialApplication {
public static void main(String args[])
{
Frame f = new Frame();
f.pack();
FileDialog d = new FileDialog(f);
d.setVisible(true);
String javaPath;
System.out.println(javaPath = d.getFile());
try
{
FileReader inStream = new FileReader(javaPath);
inStream.close();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
Sample output:
[d:\araxidev\javahacks\illegalntchartest]java -version
java version "1.1.8"
[d:\araxidev\javahacks\illegalntchartest]java -fullversion
java full version "JDK1.1.8K"
[d:\araxidev\javahacks\illegalntchartest]java -classpath d:\araxioem\private\jdk
1.1.8\lib\classes.zip;AppClasses.jar TrivialApplication
90??? fromHell.pdf
java.io.FileNotFoundException: 90??? fromHell.pdf
at java.io.FileInputStream.<init>(FileInputStream.java:56)
at java.io.FileReader.<init>(FileReader.java:35)
at TrivialApplication.main(TrivialApplication.java)
(Review ID: 57670)
======================================================================
Background:
If Windows NT's file system encounters a file with illegal characters (eg, \ / etc) it converts the illegal chars to 0xF0xx. . .
[reflects correction vs. original, based on later user comment: "I said the characters are 0xFFxx, but they're actually 0xF0xx."]
Files with illegal characters can be generated on the Mac.
Somewhere in the Java encoding, these special characters get converted to '?' (0x3F). This makes it impossible to open the file with an
InputStream or Reader object...
Code:
This application just uses a FileDialog to select a file. It then tries to open it with a FileReader which will fail with a FileNotFoundException.
You'll need to create a file with illegal chars yourself.
import java.awt.*;
import java.io.*;
public class TrivialApplication {
public static void main(String args[])
{
Frame f = new Frame();
f.pack();
FileDialog d = new FileDialog(f);
d.setVisible(true);
String javaPath;
System.out.println(javaPath = d.getFile());
try
{
FileReader inStream = new FileReader(javaPath);
inStream.close();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
Sample output:
[d:\araxidev\javahacks\illegalntchartest]java -version
java version "1.1.8"
[d:\araxidev\javahacks\illegalntchartest]java -fullversion
java full version "JDK1.1.8K"
[d:\araxidev\javahacks\illegalntchartest]java -classpath d:\araxioem\private\jdk
1.1.8\lib\classes.zip;AppClasses.jar TrivialApplication
90??? fromHell.pdf
java.io.FileNotFoundException: 90??? fromHell.pdf
at java.io.FileInputStream.<init>(FileInputStream.java:56)
at java.io.FileReader.<init>(FileReader.java:35)
at TrivialApplication.main(TrivialApplication.java)
(Review ID: 57670)
======================================================================
- relates to
-
JDK-4313884 New I/O: Character-set API
- Resolved
-
JDK-4228207 RFE: Character Encoding Converter APIs are required.
- Closed