Opening windows-1252 named files on Linux

The situation:
A bunch of files on a directory, some with English names, other with French accented names and some other with Spanish accented names. Some of the files have been created on Windows (thus named using windows-1252) and other on Linux (named using UTF-8). The directory ?/tests/? is on a Debian testing GNU/Linux Machine using UTF-8 as default enconding method.
The immediate objective. (actually not a functional one... yet)
List the properties of each file on the directory.
The problem.
Even creating a java.io.File object ?pointing? to the containing directory and then calling File[ ] listFiles( ) to get a File object for each file on the directory, the object which are suppose to point to files with accented names on windows-1252 don't reach the actual file, or at least the isFile() returns false.
I tried putting System.setProperty("file.enconding", "windows-1252") on the begining of the code but I kept getting the same result.
I'll put an example code at the end of the message as well as the output I get.
By the way, I ran the same code on windows machine and could list all the files on directory (actually all the files on that directory where named using windows-1252).
Is there a way to create a java.io.File object using a specific encoding method?
If not, is there any other way to get information from the file system?
Thanks in advance.
package local.tests;
import java.io.File;
import java.io.IOException;
public class Test1 {
     public static void main (String[] args) {
          System.setProperty("file.encoding", "windows-1252");
          FileTest handler = new FileTest("../../tests");
          try {
               handler.process();
          catch (Exception e) {
               System.out.println("Oooops Exception: "+e.getLocalizedMessage());
     } // End of main
class FileTest {
     private static File fileHandler;
     public FileTest() {
          this("");
     public FileTest(String filename) {
          fileHandler = new File(filename);
     public FileTest(File filehandle) {
          fileHandler = filehandle;
     public void process() throws SecurityException,IOException,Exception {
          System.out.println("\n??");
          if(fileHandler.isDirectory()) {
               System.out.println(fileHandler.getName() + ": is a Directory");
               processAsDir();
          } else if(fileHandler.isFile()) {
               System.out.println(fileHandler.getName() + ": is a File");
               processAsFile();
          } else {
               throw new Exception("Dude you gotta pass something valid... \n...and "+fileHandler.getCanonicalPath()+" is not valid.");
     private void processAsFile() throws SecurityException,IOException {
          System.out.println("Name: " + fileHandler.getName());
          System.out.println("Parent: " + fileHandler.getParent());
          System.out.println("Path: "+ fileHandler.getPath());
          System.out.println("Absolute Path: "+ fileHandler.getAbsolutePath());
          System.out.println("Canonical path: "+ fileHandler.getCanonicalPath());
          System.out.println(fileHandler.canRead()?"Readable":"Not Readable");          
     private void processAsDir() throws SecurityException,IOException {
          if(fileHandler.canRead()) {
               if(fileHandler.listFiles().length==0)
                    System.out.println("(Empty)");
               else
                    for(File fileInDir : fileHandler.listFiles()) {
                         FileTest auxhandler = new FileTest(fileInDir);
                         try {
                              auxhandler.process();
                         catch (Exception e) {
                              System.out.println("Oooops Exception: "+e.getLocalizedMessage());
          } else
               throw new SecurityException(fileHandler.getName()+" : " + fileHandler.getCanonicalPath()+ " : directory is not readable");
}On the ouput for the application, you can see that there's a renamed copy of the windows-1252 named file using UTF-8:
tests: is a Directory
Classical - Wagner- In the Hall of the Mountain King.mp3: is a File
Name: Classical - Wagner- In the Hall of the Mountain King.mp3
Parent: ../../tests
Path: ../../tests/Classical - Wagner- In the Hall of the Mountain King.mp3
Absolute Path: /home/offtopic/workspace/filelist/../../tests/Classical - Wagner- In the Hall of the Mountain King.mp3
Canonical path: /home/offtopic/tests/Classical - Wagner- In the Hall of the Mountain King.mp3
Readable
Oooops Exception: Dude you gotta pass something valid...
...and /home/offtopic/tests/Cd1 - 11 - Revel - Bol�ro.mp3 is not valid.
Revel - Bol?ro.mp3: is a File
Name: Revel - Bol?ro.mp3
Parent: ../../tests
Path: ../../tests/Revel - Bol?ro.mp3
Absolute Path: /home/offtopic/workspace/filelist/../../tests/Revel - Bol?ro.mp3
Canonical path: /home/offtopic/tests/Revel - Bol?ro.mp3
Readable

I downloaded and tryed with IBM's most recent jdk of the 1.5.x serie...
Even thought it didn't work... The bug is present in a different way...
IBM's jvm skips the not_UTF-8_ok encoded character and the next one.... As a result the resulting File object doesn't point the file either.
I also downloaded some java based applications which make use of the java.io.File class (and mp3 player and a file browser) and present the same problem.. they can list the file (with some problems displaying its name)... but can't open it...
I'll have a look at the release notes for java 6 to see if it fixed, if not I'll go and see if it's already reported, if not.. well I'll report it.
Thank you fellas.

Similar Messages

  • Cannot get my "attach" to work on my email program. I press it but it is not allowing to open window to browsw files that I want to attach to email

    Cannot get my "attach" to work on my email program. I press it but it is not allowing to open window to browsw files that I want to attach to email

    Hello William,
    Are you referring to Sony MiniDisc Recorder?
    Locate the model # from the below link.
    http://esupport.sony.com/US/p/support-info.pl?info_id=264
    The MiniDisc Recorder is not compatible with Windows 7 Operating System (OS) as these devices were released prior to the release of Windows 7 OS.
    If my post answers your question, please mark it as an "Accepted Solution."

  • Opening windows "Access" database files through network

    Is there any way to open windows "Access" database files on my mac through a network to a windows machine? I have the windows for mac software but it doesn't include access.

    Hi,
    As per the description, I understand that your Office 2013 cannot open files through a network share directly.
    I would like to know that how many clients/users are affected by this in your environment. It could be some specific user account settings, that the Office applications are being affected by.
    I'd first suggest you try with a new Windows user profile, then verify result.
    Regards,
    Ethan Hua
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • After downloading PSE 13, receive error message cannot open windows temporary internet files

    After downloading Photoshop elements 13, I receive an error message as it tries to open (but instead opens my PSE 9 application) and this message appears:  "cannot open C:Users\Spears\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.1E5\AV8ZNMD1\Photoshop Elements_13_LS25_win64.7z"
    I have been trying various fixes to download this for 2 days now.  Can someone please help me?
    Thanks!

    Did you check if the Firefox file is in that location?
    If it isn't there then do a clean (re)install:
    * Download a fresh Firefox copy from http://www.mozilla.com/firefox/all.html and save the file to the desktop.
    * Uninstall your current Firefox version and remove the Firefox program folder before installing that copy of the Firefox installer.
    * Don't remove personal data if you uninstall the current version.
    * It is important to delete the Firefox program folder to remove all the files and make sure that there are no problems with files that were leftover after uninstalling.
    Your bookmarks and other profile data are stored elsewhere (not in the Firefox program folder) and won't be affected by a reinstall, but make sure that you do not select to remove personal data if you uninstall Firefox.
    If the file is there then do a malware check with some malware scan programs.<br />
    You need to scan with all programs because each program detects different malware.<br />
    Make sure that you update each program to get the latest version of the database before doing a scan.<br />
    * http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    * http://www.superantispyware.com/ - SuperAntispyware
    * http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
    * http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    * http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
    See also "Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked and [[Searches are redirected to another site]]

  • How to compile and run windows built .fmb file in linux

    Hi,
    I have developer suite 10g installed in windows OS.
    i built a .fmb forms binary file in windows. now i want to compile and deploy this .fmb file into .fmx file in linux and run it.
    I have Oracle Application Server Enterprise version along with Forms/Reports services installed on my linux box.
    Can someone guide how to use my AS Form services in linux to complie and run my .fmb file.
    Thanks in advance,
    Philip.

    is there a easier way or is this the only way to
    compile a .fmb file in a linux machine.Yes, there also a way interactive(not in batch), but you have to need use X-session (GUI) variables DISPLAY
    You can compile module after module if you change $i with you form(FMB) userid
    frmcmp_batch.sh userid=scott/tiger@bs817 batch=no module=$i module_type=form
    compile_all=yes window_state=minimize
    Remember you must set FORMS PATH and ORACLE_HOME/bin where frmcmp_batch is
    Then, run file where you insert frmcmp_batch.sh
    How do i invoke forms builder, forms compiler in a
    linux machine where i have installed Application
    Server Enterprise edition?You don't invoke FORM BUILDER
    (assumption is that the "development" machine is a MS Windows platform and the "deployment" machine is a Unix platform)
    FMX, MMX, and PLX files are NOT portable between platforms. Source code (FMB, MMB, PLL) must be recompiled when moving from one platform to another. This includes moving from one Unix platform to another (i.e. Sun Solaris to Linux) or one Windows platform version to another.
    frmcmp_batch.sh is script that run executable (compiler) for Linux OS
    In Forms 10.1.2.0.2 and newer, the executable and script names are. frmcmp , frmcmp_batch..
    Once all of the executables have been generated the path to these files will need to be included in the Forms deployment environment. In most cases this will be the FORMS90_PATH value in the Forms env file, "default.env"
    I hope to have been clear
    Regards

  • Not able to open Windows Media Player files with Quicktime Pro

    Hi,
    I have recently downloaded a couple of videos that I am planning to use in FCP. The file extension of the downloaded videos is .asf and I am able to play them with Windows Media Player. However, to use them in FCP I have to convert them into Quicktime format. I have Quicktime Pro version 7.0.4 and I was told that I should be able to open the files in Quicktime therefore automatically converting them into quicktime files. It's not working and I am completely out of options and ideas.
    Please help if you ever had that problem.
    Thanks in advance

    As I understand it M$ is providing additional distribution as a sort of "seal of approval."
    Don't forget WMV/WMA is a proprietary codec from M$ and involves licensing. In that sense they're providing resources. Apparently the Flip4Mac folks are actually building it themselves though.
    Think of it as being in the construction business and you're required to buy the lumber from only one source but you still have to build the house yourself.
    I've just got done downloading the newer version and
    I hope for improvements.
    It looks like M$ is giving some resources to the
    flip4mac creators. Maybe a M$ "plant" all along?

  • WINDOWS 7 .bat file to Linux share

    Hi
    We have two new windows 7 pcs which have their drives mapped at net log on.  
    Every drives maps until it reaches that drive located on a Linux server.  Which at this point the user is prompted for a password,
    when the details are entered the drive doesn't map.
    the batch file works on windows xp pc's fine the only difference appears to be windows 7

    Hi,
    You may update all the drivers and ensure all the updates have been applied.
    This can also be caused if your DHCP server is slow/congested, or if your LAN switch is having trouble putting the port in the right VLAN
    Can you run the batch in Safe Mode with networking? If it works, I suspect that the issue is caused by your security programs or firewall.
    You may try to manually use  UNC (\\server\share) and IP (\\ip.add.res.s\share) to map the drive for a test.
    Hopefully you could resolve your issue soon.
    Regards,
    Blair Deng
    Blair Deng
    TechNet Community Support

  • Can't open Windows-saved .ai file on Mac Leopard

    As the topic states - when I open the document it only opens in preview with the following message:
    "This is an Adobe Illustrator file that was saved without PDF content. To pace or open this file in other applications, it should be re-saved from Adobe Illustrator with the 'Create PDF Compatible File' option turned on."
    I know how to get to the dialog box with the PDF compatible file option, but I've been told when this is checked it turns the ai file into a PDF and makes it uneditable. Is this true or can I check that box with all my work and still be able to edit it full in Illustrator as well as open it between PC and Mac?
    Cheers

    Inertiat,
    If you save as AI with PDF Compatibility, the file will contain two full versions of the content, one as native AI stuff, the other as dumbed-down PDF stuff.
    If you save as PDF with Illustrator Editibality, the file will contain two full versions of the content, one as dumbed-down PDF stuff, the other as native AI stuff.
    If you save as PDF without Illustrator Editibality, you just get the dumbed-down PDF content.
    IF you save as AI without PDF Compatibility, you just get native AI content.
    If you want to have full editing capability in Illustrator (regardless of whether you are crossing platforms) you need the native AI content. That means saving as a native .ai file (with or without PDF Compatibility), or as a PDF with Illustrator Editability.
    JET

  • D7100, .nef files will not open, batch rename naming files differently

    I recently purchased the D7100/Nikon and I am having problems opening the nef files in Bridge and Photoshop CS6 (even after updating – Raw 8.4) and also renaming the files.  Lightroom 4.4, no problem.
    I also tried batch renaming the files, and Bridge is not keeping the .jpg and .nef files consistent as with my old camera (D90). Also, it is creating a new date on the .nef file, rather than keeping it to the day it was shot.
    Old way:
    20140322_LasVegas_0165.jpg
    20140322_LasVegas_0165.nef
    NOW:
    20140322_LasVegas_0165.jpg
    20140413_LasVegas_0166.nef
    I do use the DNG converter to convert the .nef files, and keep all file names consistent (.jpg, .nef, .dng).
    Is something lacking in the updates for Bridge/Photoshop for this camera to view the .nef files?  Is there anything I can do in Bridge to fix the Batch Renaming?  I really do not want to go to each .nef file and rename each one individually.  Help!

    You probably forgot to include the extension .dng or renamed with an extra dot (.) in the filename. Be surr to have only 1 dot with the three letter extension dng at the end (. dng)
    You can use Bridge for that again to rename and use the dng extension

  • Windows Media Player file format invalid

    I'm running Mac OS 10.3.9 and the latest Windows Media Player 9.0.0. Sometimes when I try to open Windows Media Player files (.asx) people send me I get "Cannot play back the file. The file format is invalid." How can I get these files to play?
    Or is there another Mac application that will play these file (.asx) file formats?
    Thanks.

    Welcome to the discussions Terry!
    Videolan's VLC will play almost anything.Also, it's freeware.
    http://www.apple.com/downloads/macosx/video/vlcmediaplayer.html

  • Open a PDF file in linux using java

    Hi..
    How can I open a PDF file in linux using java.
    I am able to open PDF in windows and mac using this code
    in Windows
    Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + path_of_PDF);
    in mac
    Runtime.getRuntime().exec("open " + path_of_PDF);
    But nothing is working with linux.
    Please help
    Thanks

    One thread is enough:
    http://forum.java.sun.com/thread.jspa?threadID=5267458

  • Open PDF file in linux using java

    Hi..
    How can I open a PDF file in linux using java.
    I am able to open PDF in windows and mac using this code
    in Windows
    Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + path_of_PDF);
    in mac
    Runtime.getRuntime().exec("open " + path_of_PDF);
    But nothing is working with linux.
    Please help
    Thanks

    appi wrote:
    Hi.. I found the JDIC binary files. There are different binaries for all the plateform. Is there any solution which is independent of plateform.Yes, and we already told you: Use JDK6, which has those libraries built into the standard class library.
    How can I use these binaries in my existing project. does it work, If I place them at same place where other .class files are kept.Read the documentation of the JDIC project. I'm sure they answer this question in their FAQ.

  • Problem in opening pdf  or fdf  File in JSP page through firefox in Linux

    Hi,
    In my Webapplication , i have given link to FDF document available in server in a JSP page on click of which the corresponding FDF document should open in a new browser.
    Consider the location of FDF file in my server is
    ServerIP/MS/RDTEST/RDTEST-D-08-10245.fdf
    In my JSP link to FDF file is provided as follows.
    newpath="smb://"+username+":"+password+"@"+serverip+"/MS/RDTEST/RDTEST-D-08-10245.fdf" ;
    <a class ="one1" href="<%=newpath%>" target="dynamic" > RDTEST-D-08-10245 </a>My Requirement is When i click on the link it should open the corresponding fdf file in the browser by following the link provided.
    But it is not working if i try in this way.
    Can anybody suggest how to proceed with this issue.
    Any other ways are there to open fdf file exisitng in server in Firefox in A Linux machine.
    What settings to be made in firefox to support FDF or PDF features.
    What prerequisites needed in Linux to enable FDF or PDF features.
    I have Adobe Acrobat professional 5.0 installed in my Linux machine.
    Thanks in advance.

    Is your problem
    -. That a new browser window doesn't open?
    Solution: [Lookup the 'target' attribute|http://www.w3schools.com/HTML/html_links.asp]
    - That your file content isn't streaming to the browser?
    Solution: Your code assumes the browser understands and supports samba. This isn't always the case (IE for example). And you're providing a direct link to your file with the username and password - security concerns as well as possible portability issues. You'd be better off writing a [file servlet to download your files|http://www.google.com/search?q=file+download+servlet]

  • Problem in opening pdf file in linux

    how can i open a pdf file in linux(openSuse)..i can open .doc, .xls, .pdf in windows using the code.. its working fine..
    Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + path_of_PDF);like that i want to open in linux...
    i would be very grateful to you and i need help..plz
    plz............
    Thanks in Advance....

    I've used code like
    File path=new File("/home/RichHelp.pdf");                Runtime.getRuntime().exec("Desktop.getDesktop().open()"+path);i'm getting these errors
    java.io.IOException: Cannot run program "Desktop.getDesktop().open()/home/RichHelp.pdf": java.io.IOException: error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
    at java.lang.Runtime.exec(Runtime.java:593)
    at java.lang.Runtime.exec(Runtime.java:431)
    at java.lang.Runtime.exec(Runtime.java:328)
    at richwoods.MasterScreen.actionPerformed(MasterScreen.java:795)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1216)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1257)
    at java.awt.Component.processMouseEvent(Component.java:6038)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
    at java.awt.Component.processEvent(Component.java:5803)
    at java.awt.Container.processEvent(Container.java:2058)
    at java.awt.Component.dispatchEventImpl(Component.java:4410)
    at java.awt.Container.dispatchEventImpl(Container.java:2116)
    at java.awt.Component.dispatchEvent(Component.java:4240)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
    at java.awt.Container.dispatchEventImpl(Container.java:2102)
    at java.awt.Window.dispatchEventImpl(Window.java:2429)
    at java.awt.Component.dispatchEvent(Component.java:4240)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
    Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
    at java.lang.ProcessImpl.start(ProcessImpl.java:65)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
    ... 31 more

  • TS3212 Still unable to download itunes to my pc. Tried with IE, Mozilla and Google Chrome. Keep getting an error message :"Windows cannot open itunes.exe the file is corrupt contact support."previous itunes files were wipped out by "disk cleaner." Any hel

    Still unable to download itunes to my pc. Tried with IE, Mozilla and Google Chrome. Keep getting an error message :"Windows cannot open itunes.exe the file is corrupt contact support."previous itunes files were wipped out by "disk cleaner." Any help??
    Please!
    Thanks!

    If anyone is reading this still looking for what caused the issue and how to fix it here is what I discovered.
    The antivirus program our company uses, Bitdefender Antivirus Plus, was causing some of the PDF files not to open. After troubleshooting the different modules and settings the culprit was..
    Scan SSL in Privacy Control Settings. Turning it OFF solved the problem and all the PDF files that previously would not open now open just fine. This issue has been sent to Bitdefender for them to review. If you use a different antivirus program and are having this issue try locating the Scan SSL setting and see if turning it off solves the problem.

Maybe you are looking for

  • Repair Order Process - o/b delivery from PO, need copy routine

    Hi Experts, We are configuring repair order process and while creating o/b delivery to Vendor from PO, need to check for GTS message and should be blocked that document for further processing in ECC. For SO to o/b delivery working fine using include

  • Keeps Asking For Authorization...

    Here's the gist of the problem: I bought a song, but iTunes keeps asking me to authorize my computer and then it says it's already been authorized. It won't let me play the song. Behind the problem: I suppose I did a stupid thing. I started downloadi

  • PhotoShop ASE ver 3 HELP file

    Anyone know where I can get this file? There is a link posted on: http://www.adobe.com/products/photoshopalbum/starter.html but it only results in an error - ver 2 no longer available........

  • Non-destructive text cutting

    I have been trying to find a non-destructive way of cutting text from an image and have come up with nothing. The only way I have been able to create the effect is by deleting a selection of the text layer from the image which is not something I can

  • Display/show/print point or anchor coordinates in Illustrator CS5

    I don't simply want to see the coordinates when I hover over a point. I want the coordinates actually showing on the document. Is there a plug-in that can accomplish this easily?