Setting encoding of file *name*?

I'm getting file with names containing Latin-1 characters. The java.io.File constructors only take strings for the file names, so I can't set which encoding to use for the file names. Is there any way I can open such a file in Java?
Thanks,
-Lars

A clarification: I'm getting the name of the file as a String, i.e. the non-ASCII characters are there in Unicode in the String. Passing that String to File() results in trying to open a file whose name contains UTF-8 characters, but the file on the file system has the equivalent Latin-1 characters.
-Lars

Similar Messages

  • How can I auto export a PDF File using the "Smallest File Size" preset and set the Exported File Name based on information from an Imported PDF?

    Greetings all,
    I am trying to create a script to automate a PDF export process for my company for inDesign. I’m fairly new to inDesign itself and have no previous experience with javascript, although I did take C++ in high school and have found it helpful in putting this code together.
    We have an inDesign template file and then use the Multi-page PDF importer script to import PDF files. We then have to export two version of each file that we import, then delete the imported file and all of the pages to reset the template. This has to be done for nearly 1000 pdf files each month and is quite tedious. I’m working on automating the process as much as possible. I’ve managed to piece together code that will cleanup the file much quicker and am now trying to automate the PDF exports themselves.
    The files are sent to us as “TRUGLY#####_Client” and need to be exported as “POP#####_Client_Date-Range_North/South.pdf”
    For example, TRUGLY12345_Client needs to be exported as POP12345_Client_Mar01-Mar31_North and POP12345_Client_Mar01-Mar31_South.
    There are two templates built into the template file for the north and south file that are toggled easily via layer visibility switches. I need to get a code that can ideally read the #s from the imported Trugly file as well as the Client and input those into variables to use when exporting. The date range is found in the same place in the top right of each pdf file. I am not sure if this can be read somehow or if it will have to be input manually. I can put North or South into the file name based on which template layer is visible.
    I am not sure how to go about doing this. I did find the following code for exporting to PDF with preset but it requires me to select a preset and then type the full file name. How can I set it to automatically use the “Smallest File Size” preset without prompting me to choose and then automatically input some or preferably all of the file name automatically? (If the entire filename is possible then I don’t even want a prompt to appear so it will be fully automated!)
    PDF Export Code (Originally from here: Simple PDF Export with Preset selection | IndiSnip [InDesign® Snippets]):
    var myPresets = app.pdfExportPresets.everyItem().name;
    myPresets.unshift("- Select Preset -");
    var myWin = new Window('dialog', 'PDF Export Presets');
    myWin.orientation = 'row';
    with(myWin){
        myWin.sText = add('statictext', undefined, 'Select PDF Export preset:');
        myWin.myPDFExport = add('dropdownlist',undefined,undefined,{items:myPresets});
        myWin.myPDFExport.selection = 0;
        myWin.btnOK = add('button', undefined, 'OK');
    myWin.center();
    var myWindow = myWin.show();
    if(myWindow == true && myWin.myPDFExport.selection.index != 0){
        var myPreset = app.pdfExportPresets.item(String(myWin.myPDFExport.selection));
        myFile = File(File.saveDialog("Save file with preset: " + myPreset.name,"PDF files: *.pdf"));
        if(myFile != null){
            app.activeDocument.exportFile(ExportFormat.PDF_TYPE, myFile, false, myPreset);
        }else{
            alert("No File selected");
    }else{
        alert("No PDF Preset selected");
    So far my code does the following:
    1) Runs the Multi-Page PDF Import Script
    2) Runs PDF Export Script Above
    3) Toggles the Template
    4) Runs #2 Again
    5) Deletes the imported PDF and all pages and toggles template again.
    It’s close and much better than the original process which was almost 100% manual but I’d like to remove the Preset prompt from the PDF script and have it automatically select the “Smallest File Size” preset. and then if there’s a way to have it auto-fill in the file name so no user input is required at all other than selecting each file to import. (If there’s a way to setup a batch action for the multi-import script that would be even better!)
    Thanks in advance and if there’s anything else I can provide that would help please let me know! Even a nudge in the right direction will be a big help!

    If you hold down the option key, it will typically show the location. Or you can often hit option-return on the file and it will reveal the file in the Finder, instead of opening it.
    Final option is to open it, and just option-click the filename in the toolbar of Preview and it should show you the location.
    It's probably an attachment to an email you've received. If you have Mail set to cache emails and their attachments it'll be stashed in a subdirectory of ~/Library/Mail. Which is fine.

  • Can i set a default file name with path when using IOpenFileDialog?

    At present, if i use
    IDFile xmlDataFile("C:\\a.txt");
    openFileDialog->DoDialog(&xmlDataFile, resultFiles, kFalse, &title);
    It use "C:\" as its default folder, but the file name box is empty, what i want is to show "a.txt" as its default file name.
    It looks like there is no such api to set a default in  IOpenFileDialog.
    Am i right?

    At present, if i use
    IDFile xmlDataFile("C:\\a.txt");
    openFileDialog->DoDialog(&xmlDataFile, resultFiles, kFalse, &title);
    It use "C:\" as its default folder, but the file name box is empty, what i want is to show "a.txt" as its default file name.
    It looks like there is no such api to set a default in  IOpenFileDialog.
    Am i right?

  • Setting up the File Name of email Attachment from Received File Name

    Hello All,
    I have to send the Received File in attachment to an Email if there is any exception. Here I can attach the file, but I cannot set the file name of attachment as the Received File Name. Is there anyway of doing this without using custom pipeline component.
    Here I am using the Orchestration and SMTP Adapter.Any help is greatly appreciated.
    Thanks

    It might work if you use a custom pipeline component on your send port and in the Execute method populate the MIME.FileName property of the body part.
    Something like:
    public IBaseMessage Execute(IPipelineContext pc, IBaseMessage inmsg)
    string filename = inmsg.Context.Read("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties");
    inmsg.BodyPart.PartProperties.Write( "FileName", "http://schemas.microsoft.com/BizTalk/2003/mime-properties", "filename);
    return inmsg;
    You can take reference from similar post here
    SMTP - Setting attachment filename
    Anther good article with MIME is here
    Setting attachment filename with the SMTP Adapter
    For MIME case your SMTP message construct statement would be like below
    multipartMessage.MessagePart_1= InMSG;
    multipartMessage.MessagePart_2="This is message part2 as a string";
    multipartMessage(SMTP.Subject) ="Email From Dynamic Port";
    multipartMessage(SMTP.From) ="[email protected]";
    multipartMessage(SMTP.SMTPHost) ="yoursmypserver.com";
    multipartMessage.MessagePart_2(MIME.FileName) = "Attachment_Name";
    multipartMessage(SMTP.SMTPAuthenticate) =0;
    Thanks
    Abhishek

  • How do you dynamically set the flat file name

    Within my process flow I call a mapping. Within this mapping I have a flat file operator (which creates and writes to a .csv file). All working great.
    From this process flow I want to be able to pass a parameter to the mapping (which I can do), and use the value of this parameter as the file name of the .csv file. But I can’t seem to be able to dynamically set the ‘Default physical file name’ to this parameter value within the mapping.
    Does anyone have any ideas?
    Thanks
    Ansel

    Hi Ansel
    Check out the blog entry here;
    http://blogs.oracle.com/warehousebuilder/newsItems/viewFullItem$154
    You can use an expression.
    Cheers
    David

  • How to set "Title" as "File Name" in iPhoto 5?

    iPhoto lets you batch rename the title for your photo library of a given roll. So if you have say "Vacation" you can set title to all the photos in there as Vacation -1 , Vacation -2 etc. etc. But, this is just the title for iphoto database. The actual filename will still be as IMG_xxx.jpg (or whatever is default in your digital camera).
    Is there a way to set the Title as File name ?? I already have 1000+ photos iphoto and title is all set as my Roll Name - xx . But it will be great to have file names set as the title too.
    I think I can batch rename in Image Capture before downloading the files, but then I have to again import those in iPhoto , so its two step process and inconvenient.
    So, does anyone know how to set File name as Title ( you can only do other way around in iPhoto, I think) ? Any script available which can read iPhoto title and set the file name as Title? Thanks.
    20 iMac G5 2GHz   Mac OS X (10.4.1)   Canon S2 IS

    Hi kothrush,
    You must rename in the Finder first, before importing into iPhoto.
    You cannot do it after importing into iPhoto. Well, you can. You can share export the renamed images to the desktop. Delete the ones in iPhoto, then import the renamed ones back into iPhoto. That's a lot more steps.
    Whatever you do, you cannot rename any images in the Finder that are already in the iPhoto Library or iPhoto will lose the link to the images.
    Two Apple kbs for you to read
    Don't tamper with files in the iPhoto library folder
    About the iPhoto Library folder
    Lori

  • Set Caption as File Name?

    Sometimes people send me photos I want in my library, and those images are named with a string of text that would be a suitable caption. I've got a fair number of these images now, and I'd like to know if there is a batch way of changing the caption on those images from being blank to the file name.
    In other words, if I have a bunch of files named "1973 Summer Trip to Las Vegas.jpg", etc., but with no metadata (blank caption, etc.), is there a way to automatically set the captions as the names of the file? I know that it is trivial to rename the file or version, and I'll do that once I've saved the present file name into the caption field.
    Many thanks in advance for you help.

    "tImg" is just a variable holding an image version id. You'll note that it shows up coloured green in Script Editor like other variables.
    "tCap" in that script is a variable used to hold the value we want to put into the caption. So we set it to the name and then set the caption to it.
    A good starting point for getting the AppleScript names of different tags is:
    tell application "Aperture"
    set selectedImages to the selection
    get every IPTC tag of item 1 of selectedImages
    end tell
    Replace 'IPTC' with 'EXIF' to get a list of EXIF tag names, with 'custom' for your own tags you've added plus the timezone names, and 'other' for some other stuff like filename, pixel sizes, main rating etc. Note that in all cases the script will only list the names for tags that apply to the image - so an image with no IPTC data will return no tag names.
    A couple of good places to get started with AppleScript and Aperture:
    http://homepage.mac.com/jlarson7/news/index.html
    http://brettgrossphotography.com/category/mac/applescript
    Ian

  • How to set the default file name for upload

    Hi All,
    I have the following BSP app for a file upload of a csv file. I want the page when displayed show the default file name to be loaded as c:\db1\currentPM.csv
    What changes do I need to make to get the default file name in the BSP app.
    Thanks
    Karen
    <%@page language="abap" %>
    <%@extension name="htmlb" prefix="htmlb" %>
    <htmlb:content id               = "content"
                   design           = "classicdesign2002design2003"
                   controlRendering = "sap"
                   rtlAutoSwitch    = "true" >
      <htmlb:page title="File Upload " >
        <htmlb:form method       = "post"
                    encodingType = "multipart/form-data">
              <htmlb:textView text   = "File:"
                              design = "STANDARD" />
              <htmlb:fileUpload id          = "uploadID"
                                onUpload    = "UploadFile"
                                upload_text ="Upload"/>
        </htmlb:form>
      </htmlb:page>
    </htmlb:content>
    On Input Processing
    event handler for checking and processing user input and
    for defining navigation
    DATA: EVENT TYPE REF TO IF_HTMLB_DATA,
          DATA TYPE REF TO CL_HTMLB_FILEUPLOAD,
          LV_OUTPUT_LENGTH TYPE I,
          LV_TEXT_BUFFER TYPE STRING,
          FILE_NAME TYPE STRING,
          FILE_PATH TYPE STRING ,
          INTERN TYPE TABLE OF  ZALSMEX_TABLINE.
    DATA: LT_BINARY_TAB TYPE TABLE OF SDOKCNTBIN .
    TYPES: BEGIN OF TY_TAB,
           FIELD1(2) TYPE C,
           FIELD2(2) TYPE C,
           FIELD3(2) TYPE C,
           FIELD4(2) TYPE C,
           FIELD5(2) TYPE C,
           END OF TY_TAB.
    DATA:  WA_TAB TYPE TY_TAB,
           IT_TAB TYPE TABLE OF TY_TAB.
    TYPES: BEGIN OF TY_LINE,
              LINE(255) TYPE C,
           END OF TY_LINE.
    DATA:  WA_LINE TYPE TY_LINE,
           IT_LINE TYPE TABLE OF TY_LINE.
    EVENT = CL_HTMLB_MANAGER=>GET_EVENT_EX( REQUEST ).
    IF EVENT IS NOT INITIAL AND EVENT->EVENT_NAME = HTMLB_EVENTS=>FILEUPLOAD.
      DATA ?= CL_HTMLB_MANAGER=>GET_DATA( REQUEST = RUNTIME->SERVER->REQUEST NAME = 'fileUpload' ID = 'uploadID' ).
      FILE_NAME = DATA->FILE_NAME.
      FILE_PATH = FILE_NAME.
      IF DATA IS NOT INITIAL.
        CALL FUNCTION'SCMS_XSTRING_TO_BINARY'
         EXPORTING BUFFER = DATA->FILE_CONTENT
         IMPORTING OUTPUT_LENGTH = LV_OUTPUT_LENGTH
         TABLES BINARY_TAB = LT_BINARY_TAB .
        CALL FUNCTION'SCMS_BINARY_TO_STRING'
        EXPORTING INPUT_LENGTH = LV_OUTPUT_LENGTH
         IMPORTING TEXT_BUFFER = LV_TEXT_BUFFER
         TABLES
         BINARY_TAB = LT_BINARY_TAB.
        IF SY-SUBRC = 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        SPLIT LV_TEXT_BUFFER AT CL_ABAP_CHAR_UTILITIES=>CR_LF INTO TABLE IT_LINE.
        IF SY-SUBRC = 0.
          LOOP AT IT_LINE INTO WA_LINE.
           SPLIT WA_LINE AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
            split wa_line at ','
            INTO WA_TAB-FIELD1 WA_TAB-FIELD2 WA_TAB-FIELD3 WA_TAB-FIELD4 WA_TAB-FIELD5.
            append wa_tab to it_tab.
          ENDLOOP.
        ENDIF.
      ENDIF.
    ENDIF.

    Also, I missed another point.
    In the folder c:\dbdata I have a number of CSV files on the user frontend. I would like the BSP application to get the list of files in the folder and process them one after the other. How can I get the list of files on the folder in the user PC and how to process them one after the other.
    I want the form to display only the default folder and once I press on upload it must process all files and display the status of processing on the same page.
    Please kindly share ideas how I can implement this app.
    Thanks
    Karen

  • Interactive Form Element 7.1:  How can I set the default file name?

    I am using Interactive Form Element with 7.1 to display a pdf.  When one clicks the save button in Adobe's toolbar, the dialog defaults the file name to "F.pdf".  Is there a way to default this to a different value?

    Making customisation from the default profile is generally considered poor practice and quite often doesn't work out as planned. (If you're interested in some more information on this, [http://mockbox.net/windows-7/227-customise-windows-7-default-profile.html see here] see here)
    This article should help you with developing and deploying your customised Firefox 4 installation (without touching the Windows 7 default user profile):
    http://mockbox.net/configmgr-sccm/174-install-and-configure-firefox-silently.html

  • CR Publishing with setting of individual file name like "Customer ID"

    Hi,
    is there an option - in the publishing - to define the name of the published file individual? example from a field of the report like "Customer ID"?
    Thanks
    Serdal

    You can't use Adobe Acrobat for this. Look for a server product.

  • Setting Print Capture File Name Defaults

    Hi All.
    Major tweakage here.
    Is there a way to set the Mac Print Capture default information? Right now I get something like "screenshot 2010-06-22 at 1.09.32.png". Is there a way to get rid of the time stamp?
    Is there a way to do this for /scans/ that come in through Pages?
    Are there other default stamps such as this that I can collate in a single coherent way?
    Thanks.
    Jon
    P.S. Not sure if there is a better place to post this or not...

    Thank you very much.
    If anyone finds an affirmative answer to this and can post it to the thread I will get a notification of the answer. This one would be a nice one to be able to streamline things over here...

  • DATAEXPORT - set Dynamic File name in Calc Script

    Hi,
    I have a calc script which exports data from BSO cube to a flat file. Currently I have hard coded file name within the calc script which is
    DATAEXPORT "File" "," "D:/in/CAPXPT_FERC_*FY12*.txt";
    and, for example, I want use the substition varaible to dynamically assign the file name let' say
    DATAEXPORT "File" "," "/u11/oracle/OHDDEVD/in/CAPXPT_FERC *" + &fYear + "*.txt";
    Is there any way to set the export file name dynamically?
    Thanks for your help
    Regards,

    A kind of intriguing thought would be to use the sub var as a way to drive the file name, then grab Robb Salzmann's CDF to dynamically set sub vars on the fly, and then use a RTP to grab that string. I have no idea if this would all tie together, but it would be interesting to try.
    Here's Robb's post: http://codingwithhyperion.blogspot.com/2011/08/create-and-update-substitution.html This is my second in a row post that refers to his CDF -- it is almost like that's my pseudonym except of course I'm too thick to write a CDF.
    Regards,
    Cameron Lackpour
    Edited by: CL on Sep 20, 2011 10:36 AM
    Spelling. Arrgh.

  • Setting output file name in export transaction data package

    Hi all,
    I am running an "export transaction data" package in the data manager. I wanted to set the output file name so that it will be a constant value. I wrote the following in the package editor:
    INFO(%FILE%,\ROOT\WEBFOLDERS\COLMOBIL\VEHICLES1\DATAMANGER\DATAFILES\vehicles_to_pca2.txt)
    TASK(/CPMB/TD_FILE_TARGET,FULLFILENAME,%FILE%)
    The system run the package and reported success but the file was not created. When i did the same with an existing file name, it was not updated.
    When I run the same package with the following PROMPT command instead of the INFO command:
    PROMPT(OUTFILE,,"Please enter an output file",Data files (*.txt)|*.txt|All files(*.*)|*.*)
    The system works fine.
    Any ideas?
    TIA
    Avihay

    I am sad to report that apparently Adobe does not do a very good job with the PDF printer. I have just spent over an hour with support to get the answer we can not help you. I guess I will have to spend $50 for NovaPDF to handle my problem. It's a shame when a superior overall product like Acrobat is not able to keep up with the knockoffs on the small things.

  • Set xml file name

    Dear,
    I want to set the name of the xml sended by mail.
    I use a botton for this, cane help me to set the name of this file before attachement !
    Thanks

    I know that, but i need to set the xml file name sent by mail with information typed in a text field.
    For exemple un have a PDF file named : myPdf.pdf
    And each user of this pdf file will type in a text feld his name so the xml file should be named : brain.xml and not myPdf.xml
    Thanks

  • JFile chooser default file name setting

    Could anybody pls tell me how I can set a default file name when JFile chooser Save dialog box appears so that the user doesn't need to name the file to be saved. And I also want to get the name of a file from current selected directory so that I can warn user for the replacement, The code I tried with is as follows
    public void SaveAs()
                    String FileName="";
              JFileChooser jfc = new JFileChooser();
              int r = jfc.showSaveDialog(this);
              if (r== JFileChooser.APPROVE_OPTION)
                   FileName = jfc.getSelectedFile().getPath();
                   FileName=FileName+".java";
                   writeFile(FileName);
         }//End of SaveAs() Method
      public void writeFile(String fn)
               String contetnt="THIS IS A FILE";
              try{
                   FileWriter fw = new FileWriter(fn);
                   fw.write(contetnt);
                   fw.close();
              }catch(FileNotFoundException fnfe){}
               catch(IOException ioe){}
         }//End of writeFile(String fn) Method

    Works fine for me.
    If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)", that demonstrates the incorrect behaviour.
    http://homepage1.nifty.com/algafield/sscce.html
    Don't forget to use the "Code Formatting Tags", so the posted code retains its original formatting.
    http://forum.java.sun.com/help.jspa?sec=formatting

Maybe you are looking for