Unicode support in java.io.File.listFiles()

I am trying to list all the files in a given directory using the File.listFiles() method, yet for some reason the File objects returned have invalid paths when a file has unicode characters in its filename.
example .. a test directory has these files
tiga-dj_kicks.mp3
tr\374by_trio-elevator_music.mp3
if i call dir.listFiles() i will get ...
tiga-dj_kicks.mp3
tr?by_trio-elevator_music.mp3
why is java converting my unicode into "?"s?
i have seen other java apps that don't have this problem ... does anyone know why this is happening?
in terms of my system ... i am on linux 2.4.20 in the US and i have tried may jdk versions including 1.3.1 and the latest 1.4.2 as well as blackdown 1.4.1

It's true that System.out may not like unicode characters, so I instead I have been using a JTextArea and I know that supports my unicode.
**eek ... after a preview it seems that my unicode isn't going to show up here either :( i'll wrap brackets around what was actually displayed as unicode in my environment.
here is another test I have run ... println(String) just appends to the text area
String original = new String("A" + "\u00ea" + "\u00f1" +
               "\u00fc" + "C");
println(original);
File f = new File(original);
println(f.getPath());
f.createNewFile();
String[] files = new File(System.getProperty("user.dir")).list();
for(int i=0; i < files.length; i++)
println(files);
Output ...
[[A???C]]
[[home/ag92114/workspace/test/unicode-test/A???C]]
Test.java
Test.java~
Test.class
A???C
As you can see ... the text area correctly displayed the unicode for the String and File objects that I constructed myself, but when I list back the file I just created then my unicode is lost.
listing the directory on the shell yields ...
[ag@home:~/workspace/test/unicode-test ] ls
./ ../ A???C Test.class Test.java Test.java~
So possibly the file is not even written to the native filesystem with the unicode??
Finally I tried opening xemacs and touching a file with a unicode filename and it works fine and displays in the shell just fine, yet when I list the dir contents in java then the unicode is lost. I touched the file [[A?]] using xemacs.
shell view ...
[ag@home:~/workspace/test/unicode-test ] ls
./ A???C Test.class Test.java~
../ [[A?]] Test.java
java lists files as ...
Test.java
Test.java~
Test.class
A???C
A?
normally this is where I would concede that java just isn't capable of handling unicode in the filesystem, but I know that isn't true because I have tried other applications (jEdit, limewire) that both seem capable of listing and displaying directories and files that contain unicode. i just wish i knew how they were doing it.

Similar Messages

  • Does  BPM support the JAVA config file feature.

    Hi ,
    Does BPM support the JAVA config file feature? like based on env(local, dev, test, stage, prod) BPM aaplication can have different values for the same property/variable using the config file. How can BPM identify its env (local, dev, test, stage, prod)
    Thanks In Advance!
    Sreekant

    931907 wrote:
    Hello Robert,
    I am refering here to both C++ client and Coherence Server. Will it work in either of the cases?
    Thanks,
    JayHi Jay,
    Coherence server: it definitely won't do anything with C++.
    C++ client: for the cache store of a local cache residing within the C++ client you may be able to specify it, but it will have nothing to do with the cluster itself. I never worked with the C++ client, so I can't guarantee you can configure it that way. Look at the following page for further documentation:
    http://docs.oracle.com/cd/E24290_01/coh.371/e22839/cpp_config.htm
    Best regards,
    Robert

  • Version of Unicode supported by Java 1.3.1 and 1.4

    Does anyone know exactly which versions of Unicode are supported and NOT supported by Java 1.3.1 and 1.4? My understanding is that v2 and v3.00 are supported in 1.3.1, but not sure about v1.x. Java 1.4.0 supports v3.0x (not 3.1), but what about Unicode v2.x or v1.x? Is there a list somewhere?

    J2RE 1.3.1 provides Unicode 2.1 support. J2RE 1.4 now supports Unicode 3.0. By "support" I mean that:
    1. Unicode character properties are available.
    2. Collation and break iterators should work.
    3. Case map operations should work.
    It would be nice if Character provided an API like getUnicodeVersion(). The javadoc for Character does tell what Unicode version is supported...at least in 1.4.
    J2RE 1.4 does not support Unicode 3.1 or 3.2 because the Unicode specs were not stable at the time the J2RE 1.4 specs were solidified. The Java I18N team is committed to tracking the evolving Unicode standard. The next major release of the Java platform will most likely support the existing version of Unicode at that time.
    Regards,
    John O'Conner

  • Enable unicode support

    I have nokia 6500 slide model phone.
    How I can enable unicode support for reading "jar" file in regional language, especilly in malayalam language

    It is not just about enabling Unicode support (and for all that matters, the phone might already have full Unicode support).
    It is a case of having the correct fonts as default/system fonts for displaying the characters.
    On S40 based models, you cannot install your own font files to replace system/default fonts.
    So, if you want to read/see malayalam language content, and the phone does not support it, you can try a Nokia repair center in case there is a firmware version with support for that language, or you can change to some other phone model which supports the language, or supports installable font files.

  • Java.io.File not found in JDK 1.4

    why the java.io.file is deprecated.
    Frans

    [fthamura],
    why the java.io.file is deprecated.Probably because in J2SE 1.4, the New I/O package java.nio package provides scalable I/O operations for files. Through the File channels, a programmer will be able to provide memory-mapped buffers, improved file locking mechanism and faster I/O transfers with the new API package.
    FransHTH.
    Allen Lai
    Developer Technical Support
    SUN Microsystems
    http://www.sun.com/developers/support/

  • How to read the java class file to convert it in java.

    hello all,
    i m developing the java application which generated the java code from the java 'class file' .
    Can anybody please help me, Is any java support for reading the class file? or how to know the class file format?
    I know the application javad, jad, javap which is doing the same thing.
    thanks for reply,
    - Jayd

    do you mean decompiling? there are tons of java decompilers available out there, what exactly are you trying to do here?

  • Converting Java class file to .dll

    Dear all,
    Is there any way to convert a Java class file to a .dll file?
    (Background being that there is a software that only allows callouts to DLLs and the method I have developed is in Java so need to convert it to a .dll)
    Any insight/advice/pointers are most appreciated.
    Thanks much,
    David

    Hi there,
    Yes you can convert a Java Class to DLL file using Microsoft Visual J#.NET (Installation required Visual Studio.NET) you can download it from the microsoft site.
    www.microsoft.com/downloads
    then go for search below in combo box(Visual J#.NET). After installation open new project select class library. write your java code(not fully supported j2se). build your application. All the Java Code is embeded in dll. Found at e.g. C:/JavaToDll/bin/debug/JavaToDll.dll This is a way to convert Java Code to a dll. frankly speaking i do not like .NET (copy of Java Technology must be baned completely).
    Thanks
    Please correct if i am wrong.
    Yahya Kamran (Software Engineer)

  • Java Card File System ...Please reply

    Hi all ,
    I am working on Java Card technology for last one year . Presently I am facing some problem regarding some file concept of java card .
    I know that Java Card 2.1 does not support file system . But I want to simulate the file system in java card using applets . i.e . I want to write an application(applet) , which can simulate the EF , DF in smart card . Whenever APDU command is send to the file system applet , it should generate a Elementary file (EF) or dedicated file (DF) etc and store data to that file.
    Can I do this type of thing using Java Card ? I am really in doubt .
    If you have any idea on this , please let me know your view on this . If you know any open source code for this type of simulated Java card file system , please let me know .
    I am desperately looking for a help .
    regards
    Dibyendu .
    you can contact me to this email
    [email protected]

    dear duran ,
    You have written that
    "Follow the guidelines for the different supported filesystems on the JC"
    But after Java Card version 2.0 , it does not support file system . I am using Java Card 2.1 .
    Could please some sample code to my mail Id , so that I can take a look at it .
    My mail id is : [email protected]
    Please share the idea , as I am really need some help.
    Regards ,
    Dibyendu.

  • Java.io.File only returns similar file names

    I have written a bean which reads a directory and places the file names in an array, which can be accessed by a JSP page. At first, the files inside the directory were named wb_1.jsp, wb_2.jsp, wb_3.jsp and so on. When I change a filename to something like work.jsp, it still appears in the file list, but when I rename it to something like identify.jsp, it doesn't!
    If I count the array, it does read the correct number of files.
    Class FileHandler
    // Imports
    import java.io.File;
    // Class
    public class FileHandler
         // Constants and variables
         public File dir;
         public File[] files;
          * Returns the number of files found inside the given directory
         public int showFiles()
              try
                   setDir(getDir());     // Get file directory as set in the bean property
                   files = dir.listFiles();     // List the files found inside the directory
              catch (Exception e)
                   System.out.println(e + " : No files found to return a value");
              return files.length;      // Return the number of files
          * Returns the file name by using the in value in the files array
         public String returnFileName(int in)
              return files[in].getName();     // Return the name of the file
          * Sets dir file type to the setproperty value in
         public void setDir(File in)
              dir = in;     // Set class variable value for dir
          * Returns the dir value
         public File getDir()
              return dir;     // Return the setproperty value for dir
    }And the JSP code which reads the array
    out.println("<select onChange=\"jumpMenu('top',this,0)\" size=\"5\" style=\"width: 200\"");
    String fileName = new String();
    for(int x=0; x<file.showFiles(); x++)
         fileName = file.returnFileName(x);
         out.println("<option selected value=\"beheer.jsp?action=2&file=" +  fileName + "\">" +  fileName +"</option>");
    out.println("</select>");

    I forgot bean properties im the above code lines. Here it is, just in case.
    <jsp:useBean id="file" class="FileHandler" scope="page" />
    <jsp:setProperty name="file" property="dir" value="C:\\IBM Websphere workspace\\Project\\Web Content\\WEB-INF\\include" />

  • Problem with file.listFiles() of File class??

    Hi all friends,
    Iam facing with one peculiar problem,Iam using [file.listfiles()] method of File class in my program and this method of file class introduced in Java2.Now when Iam runing on Mac OS classic(8 to 9)[it is my client requirement they can't change Mac OS classic to Mac OS X] it is giving me error file.listfiles() not found in java.io package coz in Mac classic I have used MRJ2.2.6(for runtime) and MRJ SDK2.2 which is based on jdk1.1.8 and this method[listfiles()] added in java2.But now for me I can't change this method in program coz it is a big code and I have to change lot of things in my program.Can any one plz tell me can i find any (java.io) package of java2 seperately in the from of .jar or .zip so that i can keep it in my MRJCLASSES folder and from there I can import it in my program.Eagerly waiting for reply.
    Regards
    Bikash

    Just use File.list(). There are minor semantical differences but they are easy to work around.

  • How to configure Java Properties File location in WLW

    How do we tell Workshop 7.0 where to look for Java properties files (loaded by
    PropertyResouceBundle in code) ?
    Thanks,
    Ray

    Ray,
    The build number indicates that you have not upgraded to Service Pack 2 of
    version 7.0. I will strongly recommend you to do so. That will shield you
    from the issues which were fixed in the 2 service packs.
    Regards,
    Anurag
    "Ray Yan" <[email protected]> wrote in message
    news:[email protected]...
    >
    Raj,
    We are using WebLogic Workshop Build 7.0.1.0.0829.0 on Windows 2000.
    We shut down the WebLogic Server on Solaris 2.6, log off, log back on,startWebLogic
    in production nodebug mode, and re-run jwsCompile on the same source code.The
    error does not occur anymore. Everything seems to be fine now.
    Thanks,
    Ray
    "Raj Alagumalai" <[email protected]> wrote:
    Hello Ray,
    Can you let me know if you are using the GA version of WebLogic Workshop
    or
    if you have the latest Service Pack.
    Thank You,
    Raj Alagumalai
    WebLogic Workshop Support
    "Ray Yan" <[email protected]> wrote in message
    news:[email protected]...
    Anurag:
    Thanks for your response!
    By moving the property files to WEB-INF/classes from WEB-INF, we arealmost there.
    But we have a follow up problem. We use a static initializer to loadthe
    log4j
    property file like this:
    static {
    try {
    ClassLoader cl= (new Log()).getClass().getClassLoader();
    InputStream is = cl.getResourceAsStream(logfile);
    Properties props = new Properties();
    props.load(is);
    PropertyConfigurator.configure(props);
    } catch (Exception e) {
    e.printStackTrace();
    When we run jwsCompile, we keep getting this:
    Compiling: com/****/TestWS.jws
    weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[weblogic.management.Admin
    may only be used on the Server ]
    at weblogic.management.Admin.getInstance(Admin.java:104)
    at
    weblogic.security.internal.ServerPrincipalValidatorImpl.getSecret(ServerPrin
    cipalValidatorImpl.java:79)
    at
    weblogic.security.internal.ServerPrincipalValidatorImpl.sign(ServerPrincipal
    ValidatorImpl.java:59)
    at
    weblogic.security.service.PrivilegedActions$SignPrincipalAction.run(Privileg
    edActions.java:70)
    at java.security.AccessController.doPrivileged(Native Method)
    at
    weblogic.security.service.SecurityServiceManager.createServerID(SecurityServ
    iceManager.java:1826)
    at
    weblogic.security.service.SecurityServiceManager.getServerID(SecurityService
    Manager.java:1839)
    at
    weblogic.security.service.SecurityServiceManager.sendASToWire(SecurityServic
    eManager.java:538)
    at
    weblogic.security.service.SecurityServiceManager.getCurrentSubjectForWire(Se
    curityServiceManager.java:1737)
    at weblogic.rjvm.RJVMImpl.getRequestStream(RJVMImpl.java:434)
    at
    weblogic.rmi.internal.BasicRemoteRef.getOutboundRequest(BasicRemoteRef.java:
    88)
    at
    weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java
    :255)
    at
    weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java
    :230)
    at
    weblogic.jndi.internal.ServerNamingNode_WLStub.lookup(Unknown
    Source)
    atweblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:337)
    atweblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:332)
    at javax.naming.InitialContext.lookup(InitialContext.java:345)
    at weblogic.knex.bean.EJBGenerator$1.run(EJBGenerator.java:101)
    at
    weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:780)
    atweblogic.knex.bean.EJBGenerator.lookupAdminHome(EJBGenerator.java:84)
    atweblogic.knex.bean.EJBGenerator.ensureAdminHome(EJBGenerator.java:122)
    at weblogic.knex.bean.EJBGenerator$6.run(EJBGenerator.java:660)
    at
    weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:821)
    atweblogic.knex.bean.EJBGenerator.generateJar(EJBGenerator.java:482)
    at
    weblogic.knex.dispatcher.DispJar.generateJar(DispJar.java:401)
    atweblogic.knex.dispatcher.DispCache.ensureDispUnit(DispCache.java:695)
    atweblogic.knex.compiler.JwsCompile.compileJws(JwsCompile.java:872)
    at
    weblogic.knex.compiler.JwsCompile.compile(JwsCompile.java:619)
    at weblogic.knex.compiler.JwsCompile.main(JwsCompile.java:109)
    ejbc successful.
    Generating EAR ...
    The EAR was generated and we can even deploy it on Solaris. But whatdoes
    the
    AssertionError mean?
    Thanks,
    Ray
    "Anurag Pareek" <[email protected]> wrote:
    Ray,
    ResourceBundle looks for the properties file in the current thread's
    classpath.
    Since a Workshop webservice's project is nothing but a webapp, the
    properties files can be kept in the WEB-INF/classes directory, which
    is part
    of the webapp classpath.
    You can also use
    Thread.currentThread().getContextClassLoader().getResourceAsStream("MyProp
    s
    properties"); to get access to the properties file.
    Thanks,
    Anurag
    "Ray Yan" <[email protected]> wrote in message
    news:[email protected]...
    How do we tell Workshop 7.0 where to look for Java properties files(loaded by
    PropertyResouceBundle in code) ?
    Thanks,
    Ray

  • Mp3 support in Java

    I want to write a decent multi-media player in Java so I can run it on both Linux and Windows. As of yet however, I have not come across any support in Java for the mp3 format. It supports .au and .wav files, but I have yet to see mp3 support. Does anyone have any experience of working with mp3's in Java? I'd appreciate greatly any help.

    Hi,
    type "JMF" in the search field and search for it - its the Java Media Framework, a kind of add-on you can use for that.A Media player is provided too by JMF as example application. Have fun ...
    greetings Marsian

  • Java.lang.NoSuchMethodError:java/io/File:

    hi all,
    i have just a dbf file and no database server, can i still use the JDBC driver to make a connnection?
    If yes, i put my dbf file in the Tomcat root directory and write con=DriverManager.getConnection("jdbc:DBF://localhost:8080/","","");
    but it always returns an error
    java.lang.NoSuchMethodError:java/io/File: method getCanonicalFile()Ljava/io/File ; not found
    Anyone know what's wrong?
    Below is the driver readme for the URL format:
    URL format:
    Direct Access:
    jdbc:DBF:[/]/[DatabasePath]
    For example: "jdbc:DBF:/." "jdbc:DBF:/../dbffiles"
    Access by DBF Server: Skip it if you don't use RMI or JINI.
    jdbc:DBF:[/][host][:port]/[DatabasePath]
    Default host:localhost port:2129 DatabasePath:
    For example: "jdbc:DBF://domain.com:3099/../dbffiles" if one DBFServer is run on the 3099 port of domain.com
    */

    We got a similar error the other day trying to grab the Meta-Data.
    Once I took those lines out everything else worked fine. Ie our connection and loading code was fine.
    It seems that not all methods are supported on all implementations of the jdbc/odbc drivers.
    Our current issue has to do with having a lot of different databases, and not wanting to set up ODBC links to all of them (or wanting to find an easy way to do that).

  • Java.io.file filename format?

    Hi,
    When using java.io.file to read filenames in a directory, which format is the resulting string (ie unicode, utf-8, system dependant)? When I read a directory with chinese characters, the output to screen is question mark.
    I know this could be a problem with output but I have no idea where to start to test that.
    Thanks for any help!

    What am I missing? I don't see a point to this post.

  • Queries on Mac OS X support for Java 1.3

    Hi All
    I am having some trouble figuring out how to make Swing based Applets
    work on Mac OS X. Can anybody help me ?
    Queries on Mac OS X support for Java 1.3
    1) Will a Java Applet compiled using Java 1.3 run on "Mac OS X" without the need for a Plugin.? This includes Applets using Swing since we compiled using 1.3.
    2) I tried to run some Java 1.3 applets compiled using 1.3.1-04.
    Unfortunately, the Applets wouldn't run.
    Is there some setting in Mac OS X that i need to change or modify for the Applet to work ?
    3) When i open a Terminal in Mac OS X and type Java -version, i get
    "------ Java 1.3---------".
    This implies that Mac OS X supports the Java 1.3 SDK. Does it imply that it supports the runtime as well since this is usually the case ?.
    If it supports the runtime, then does this inculde support for Swing.
    Finally, as i enquired in '(1)' does this mean that i do not need any plugin(MRJ) to make Swing based applets work.
    Thanks and regards
    Prashanth

    What I am seeing is that Java is throwing a security error when file io is initiated by an external call from Javascript to a file on the server that java should have access to. Here is the error.
    <<< ProxyClassLoader: defined LiveConnectProxy class. >>>
    <<< Here're the permissions you've got: >>>
    <<< java.security.Permissions@157402b (
    (java.net.SocketPermission www.dhba.com connect,accept,resolve)
    >>>
    VirtualLab.loadProblemSpecification: properties file=assignments/Walkthough.xml
    http://www.dhba.com/wested/applet/assignments/Walkthough.xml not retrieved
    java.security.AccessControlException: access denied (java.io.FilePermission assignments/Walkthough.xml read)
    My system:
    Mac OSX10.6.4 with Firefox3.6.12 (Java Plug-in 1.6.0_22 Using JRE version 1.6.0_22-b04-307-10M3261 Java HotSpot(TM) Client VM)

Maybe you are looking for

  • Web dynpro application does not exist

    hello, I wanted to ask reagrding the above error I am facing, I get an error message when I try to test the web dynpro service in the SICF. Get an error message additionally"RABAX_STATE". Previously my web designer was working and now it doesnt work

  • Syncing Outlook 2010 contacts in Windows 7 32bit with iphone 4

    I have recently upgraded from windows vista to windows 7 32 bit home professional and upgraded from Outlook 2003 to 2010.  I also have the latest software on the iphone 4 and in itunes.  For some reason I can sync all the itunes data but I can't sync

  • InDesign CS4 js Zero point

    Hi, InDesign has 3 zero points: two in the upper left corner for x and y and second x in upper right corner. When I rotated graphic that is bigger than the artbord, it ocasinally gets confused which x zero to use and rotates the graphic of the artbor

  • Problems with my library after installing itunes 7

    I have just installed itunes 7 and when i set it up i have obviously clicked on something wrong as it has rearranged my entire collection and renamed everything, it has put every file from my computer in my library. Is there any way of taking it back

  • UPK and PeopleBooks

    Team, How to integrate UPK and PeopleBooks on HRMS 9.1 and PT 8.52.04, So that both can be used as context-sensitive help in PeopleSoft. I've heard it can, but how is it done? Also, like to know from below which i have to download and installed Oracl