Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
WinXP
Description
Looks like Harmony is unable to create file if its name contains non-ASCII characters. Please see the test case below.
TestAsianFileName.java
—
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
public class TestAsianFileName {
static final String FILENAME="\u30d5\u30a1\u30a4\u30eb1.txt";
public static void main(String argv[]) throws Exception {
final String CONTENT = "A pretty predicament";
final String CNTNT_CHARSET = "ISO-8859-1";
File f = new File(FILENAME);
FileOutputStream fos = new FileOutputStream(f);
FileInputStream fis;
f.createNewFile();
fos.write(CONTENT.getBytes(CNTNT_CHARSET));
fos.close();
if (f.exists()) {
byte tmp[] = new byte[256];
String wasRed;
int n;
fis = new FileInputStream(f);
n = fis.read(tmp);
wasRed = new String(tmp, 0, n, CNTNT_CHARSET);
if (!CONTENT.equals(wasRed))
} else
{ System.out.println("FAIL: file does not exist"); return; } System.out.println("PASS");
}
}
Attachments
Attachments
Issue Links
- is related to
-
HARMONY-4876 [drlvm][classloader] unable to load class with non-ASCII character in name
- Open