> When running a program in Java 1.3 on AIX file.isFile() returns true
> on af file containing special characters (that is Danish
[quoted text clipped - 4 lines]
>
> Does anyone have any kind of experience with this?
Did you mean to say that the file *name* contains Danish characters?
I'll guess that the character encoding used in your program isn't the
same as that used when you created the file, so the names differ.
Here's a test: create such a file from your Java 1.5 application, then
test with file.isFile(). This should work properly, since the same
encoding will be used in both cases.
The way to fix this is to use the correct locale settings in your
various applications.
/gordon

Signature
[ don't email me support questions or followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
René Schade - 27 Oct 2006 14:08 GMT
> The way to fix this is to use the correct locale settings in your
> various applications.
OK, how do I change the local settings?
BTW I should have said unicode-characters instead of danish characters.
René
> Hi,
>
[quoted text clipped - 8 lines]
> Regards,
> René
The contents of the file shouldn't make any difference. Do you mean the filename
contains special characters?
File.isFile() doesn't attempt to open the file or in any way examine the
contents. If File.isFile() is returning false then the file doesn't exist (or
can't be accessed) or it's not a regular file (as determined by the type of the
file, not it's contents). If the file really exists and is a regular file and
you have permission to access it then there is probably something wrong in the
pathname which you have specified, i.e it isn't being understood by Java or the
filesystem.
Can you give us the full pathname, and the permissions to the the file in all
directories on the path?

Signature
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
René Schade - 27 Oct 2006 18:17 GMT
> File.isFile() doesn't attempt to open the file or in any way examine the
> contents. If File.isFile() is returning false then the file doesn't exist (or
[quoted text clipped - 3 lines]
> pathname which you have specified, i.e it isn't being understood by Java or the
> filesystem.
I have two similar files created by the same system - same permissions
and located in the same folder. The only differende between the two
files is the filename. The first file has the filename "test", here
file.isFile() returns true. The second file has the name "testæ" (I
don't know if you can see the last character in the filename, but it is
a character used in the danish language and thus UTF-8 character), here
file.isFile() returns false.
On Windows isFile() returns true on both files.
René
Oliver Wong - 27 Oct 2006 21:58 GMT
> I have two similar files created by the same system - same permissions
> and located in the same folder. The only differende between the two
[quoted text clipped - 5 lines]
>
> On Windows isFile() returns true on both files.
Try specifying the name in your Java code as:
file = new File("test\u00E6");
Or whatever the unicode for the character is.
If that fails, try testing file.exists() to see if Java can see the file
at all.
If that fails, try posting an SSCCE
(http://acronyms.thefreedictionary.com/SSCCE) here so that we can spot any
other mistakes that might pop up (I don't expect the SSCCE to be much longer
than 10 lines).
If that fails, post a bug to Sun.
- Oliver
René Schade - 28 Oct 2006 16:06 GMT
Oliver Wong skrev:
> Try specifying the name in your Java code as:
>
[quoted text clipped - 4 lines]
> If that fails, try testing file.exists() to see if Java can see the file
> at all.
Hi Oliver,
I get acces to the file by calling dir.listfiles() which returns a list
of files.
On each file i the call isFile(), so Java can see the file.