How to read file in foreign lanuage

Hi guys,
I'm currently started learning to write my first Air program.
i parsed a csv file using flash.filesystem.File and
flash.filesystem.FileStream and i was successful in reading the
content of the csv file in UTF-8. However, when the file is either
in unicode or it has chinese characters in it, it all becomes ???
signs... Is there any way i can convert the encoding or some sort?
Thank you very much for your help in advance.
Best Regards,
Richie

You may be looking for the FileStream.readMultiByte() method,
which takes the encoding as an argument. Note that you have to know
what encoding is used in the file; there's no way for AIR to
determine that a priori.
Oliver Goldman | Adobe AIR Engineering

Similar Messages

  • [Urgent] How to read files from different directories?

    I am new to Java Programming, I would like to know how to read files from directories other than the current one? (example as follows)
    ProjectDirectory
    |--MainDirectory
    |--MainProgram.java
    |--SupplementDirectory
    |--SupplementProgram.java
    |--Pictures
    |--Image.gif
    What should I write in the MainProgram.java so that I can use the supplementProgram.java from MainProgram and read the Image.gif file from the MainProgram.java?
    Thanks

    Run through the I/O tutorial here. It should get you up to speed on this sort of thing...

  • How to read file from remote machine

    Hello,
    Hi, i would like to know how to read text file from remote machine using java source code, any code ?
    Thanks very much;
    Best regards
    Kim

    On the server, perform the following steps:
    Parse the request and determine the file to serve
    Open a FileInputStream to the appropriate file
    Obtain a reference to the Servlet OutputStream
    Pipe the bytes from the file to the output stream
    Flush and close the streamYou might want to call HttpServletResponse.setContentType("application/octet") to indicate to the browser that a file download will be occurring. Do so before getting the reference to the Servlet's OutputStream.
    - Saish

  • How to read file from server if I have a logical file path?

    Hi guys,
    I'm having a pretty "on the run" question,
    My program is currently reading a file from server using "open dataset" with file path like this (just example)
    /usr/interface/abc/bcd/testfile.dat
    Now I got a requirement to make it more consistent to read files, instead of reading that physical file name, I should read the files from a specific folder using logical path.
    So I go to T code "FILE" and created a logical path called ZABC_FILE_PATH, unix compatible, with physical path is (for example),
    /usr/interface/<sysid>/<client>/<filename>
    My question is, can I still use open dataset statement to read this? if yes, how do I do that? If no, there should be alternative way, please let me know what you think. Thanks,

    Thanks all, I figured it out.
    ONe thing is that typo double quote
    The other thing is the importing part, I need the full file path.
    CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
      EXPORTING
        CLIENT                           = SY-MANDT
        logical_path                     = 'ZABC_MY_LOGICAL_FILE_PATH'
    *   OPERATING_SYSTEM                 = SY-OPSYS
    *   PARAMETER_1                      = ' '
    *   PARAMETER_2                      = ' '
    *   PARAMETER_3                      = ' '
    *   USE_BUFFER                       = ' '
        file_name                        =  v_1
    *   USE_PRESENTATION_SERVER          = ' '
    *   ELEMINATE_BLANKS                 = 'X'
      IMPORTING
        FILE_NAME_WITH_PATH              = v_what_I_need
    * EXCEPTIONS
    *   PATH_NOT_FOUND                   = 1
    *   MISSING_PARAMETER                = 2
    *   OPERATING_SYSTEM_NOT_FOUND       = 3
    *   FILE_SYSTEM_NOT_FOUND            = 4
    *   OTHERS                           = 5
    I really appreciate your contributions, thanks again!

  • How to read file header/open filein binary mode

    i am using FileConnenction API to read from a file. how can i open a file in binary mode so that i can read file header. In other words i want to open a file in binary mode.

    You can always try looking at the [Header Signatures|http://www.techpathways.com/uploads/headersig.txt]. But it would probably be easier to adjust your application so it doesn't have to guess.
    ~

  • How to read files in whole directory

    hi everybosy i have got a directory called grepdatabase in the following path
    /users/zer/gd.
    it has 3000 files in it.i have to read each file and do soem process and write it into another file.
    but with the following code it says, directorydoesnot exists.but i have the directory,with all the files in it.
    File database = new File("c:/Domain/nbi.bbsrc.ac.uk/Users/zer/gd");
            if (database.exists() && database.isDirectory()) {
                String datafiles[] = database.list();
                for (int i = 0; i < datafiles.length; i++) {
                    System.out.println("processing file: " + database.getAbsolutePath() +
                            "/" + datafiles[0]);
            } else {
                System.out.println("Database exists: "+database.exists()+"\nDatabase is Directory: "+database.isDirectory());
            }can anyone help me how to read multiple files...

    ur code can be little modified as follows to make it work flawlessly
           File database = new File("c:/Domain/nbi.bbsrc.ac.uk/Users/zer/gd");
                  if (database.exists() && database.isDirectory()) {
                      //String datafiles[] = database.list();
                      //Instead use file list here
                      File[] datafiles = database.listFiles();
                      for (int i = 0; i < datafiles.length; i++) {
                      //    System.out.println("processing file: " + database.getAbsolutePath() +
                      //            "/" + datafiles[0]);
                       System.out.println("processing file: " + datafiles.getName());
    } else {
    System.out.println("Database exists: "+database.exists()+"\nDatabase is Directory: "+database.isDirectory());
    BR

  • How to read files....plzzz

    Hi! All,
    I have a problem in reading files using jfilechooser class.
    when i select open menuitem from the file menu and reading it through
    the file reader class it is giving nullpointer exception.
    Also i tried by hardcoding filename in filereader class instead of using getSelectedfile().This time it is not giving null pointer exception but it is showing any stuff.
    Here's the code i am using...
    int returnVal = fc.showOpenDialog(openpanel);
    if(returnVal == JFileChooser.APPROVE_OPTION){
    file = fc.getSelectedFile();
                   //This is where a real application would open the file.
    if(fc == null)
         file = new File("D:\\karthik\\java\\");
         file = new File("D:\\karthik\\java\\kar.txt");
         fc.setCurrentDirectory(file);
    BufferedReader infile = new BufferedReader(new FileReader(file));
         files.append(infile.readline()); //files is the textarea..

    how come you do a fc.setCurrentDirectory(file);?
    where exactly do you get the NullPointerException? what does your stacktrace say?
    thomas

  • HOW to read file using ftp???

    Hi to all,
    I have problem with reading file using ftp connection, i want to read only 1024 bytes for one time, and i have
    next code wich read this:
    byte buffer[] = new byte[1024];
    while( (readCount = input.read(buffer)) > 0) {
    bos.write(buffer, 0, readCount);
    but I dont know how to put all read data in one byte[] if i dont know length of file.
    I can't do some like: byte file[] = new file[1000000];
    Thanks for all sugestions!

          * Download a file from a FTP server. A FTP URL is generated with the following syntax:
         * <code>ftp://user:password@host:port/filePath;type=i</code>.
          * @param ftpServer FTP server address (incl. optional port ':portNumber').
          * @param user Optional user name to login.
          * @param pwd Optional password for <i>user</i>.
          * @param fileName Name of file to download (with optional preceeding relative path, e.g. one/two/three.txt).
          * @param destination Destination file to save.
         * @throws MalformedURLException, IOException on error.
         public void download(String ftpServer, String user, String pwd, String fileName, File destination) throws MalformedURLException, IOException {
            if (ftpServer != null && fileName != null && destination != null) {
                StringBuffer sb = new StringBuffer("ftp://");
                if (user != null && pwd != null) { //need authentication?
                    sb.append(user);
                    sb.append(':');
                    sb.append(pwd);
                    sb.append('@');
                }//else: anonymous access
                sb.append(ftpServer);
                sb.append('/');
                sb.append(fileName);
                sb.append(";type=i"); //a=ASCII mode, i=image (binary) mode, d= file directory listing
                BufferedInputStream bis = null;
                BufferedOutputStream bos = null;
                try {
                    URL url = new URL(sb.toString());
                    URLConnection urlc = url.openConnection();
                    bis = new BufferedInputStream(urlc.getInputStream());
                    bos = new BufferedOutputStream(new FileOutputStream(destination.getName()));
                    int i;
                    while ((i = bis.read()) != -1) { //read next byte until end of stream
                        bos.write(i);
                    }//next byte
                } finally {
                    if (bis != null) try { bis.close(); } catch (IOException ioe) { /* ignore*/ }
                    if (bos != null) try { bos.close(); } catch (IOException ioe) { /* ignore*/ }
            }//else: input unavailable
        }//download()If you don't want to strore the data into a file, use ByteArrayOutputStream instead of a FileOutputStream.

  • How to read File Header in JAVA

    I wanna upload a(doc/pdf) file from client site, where I hv to check whether the the file is originally a doc/pdf file or not, I mean not just the extension, but the actual header information of the file. Please some body help me to do this, I dont know how to read the file header. Thnx in advnc.

    You can always try looking at the [Header Signatures|http://www.techpathways.com/uploads/headersig.txt]. But it would probably be easier to adjust your application so it doesn't have to guess.
    ~

  • How to read file in flex ?.

    can anyone of you help me to know how to read a file in local
    disk with flex.

    You cannot! Flex is flash player based player meant to work
    with browsers and browsers are not allowed to access the local
    disks.
    You can either read/write file on the server. or consider
    using AIR.
    ATTA

  • How to read file on demand (or) avoid polling in bpel 11g?

    Hello -
    Scenario - Receive two files(A & B) which should end up in two tables (Header, Lines)
    BPEL process -
    1) Receive acitivity - To Read file (A) via File adapter
    2) Tranformed
    3) Invoked the Db adapter to insert into "Header" table
    4) Added another Receive activity - To Read file (B) via File adapter
    5) Transformed
    6) Invoked the Db adapter to insert into "Line" table
    Issue - Step 4 gets fired as a SEPARATE instance (but no data in lines table) . At the end - I see the BPEL process which is waiting for File B. Even after I dropped File B - I dont see any records going into tables.
    Is there a better way to design this process? Do I need to separate BPEL process to insert into Header & Line table? If so - how can I make this sequential process?
    Appreciate detailed steps, if possible
    Thanks
    Babu

    If its really a SyncRead Step 4 willl not run as a seperate process.
    Step1: Initiates the process once the header file arrived
    Step4: Will be invoked like a normal partnerlink.
    Just make sure, you put the lines file before the header file in the directory.
    If it doesnot resolve the problem, send your project to me helloprasanna at rediffmail.com . I'll have a look.
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • WebDynpro: How to read file content?

    Hi,
    My business scenario requires:
    1, The file name is passed in through inbound plug parameter
    2, I need to read the file content and then attach it to my CRM transaction
    Please share with me how to read the file content.
    The following approaches do not fit my scenario:
    1, UI element: FileUpload
    The reason is obvious: there is only file name parameter instead of any UI interface
    2, Function Module: GUI_UPLOAD
    The reason is that dump will happen in WebDynpro environment
    Thanks & Best Regards,
    David

    HI,
    Refer these links  -
    Get content document in WD abap
    Excel File to Internal Table

  • New to J2ME, dont know how to read files on phone mem

    i check all the .io packages, still cant find any class that would help me to read files on phone memory.
    and i see that javax.microedition.media.Manager.createPlayer(String locator), require a string input argu. how can i make this string locator point to a media file on phone memory of TF-card.
    i heard Kjava has some packages from j2se, is there any class would help me? plz someone give me a link of Kjava reference, i cant find it anywhere, thx a lot!

    oh~~~no!
    i am afraid i cant enjoy myself with file conn.
    i tried several times, only to get a "Security Exception", and i contacted with moto dev center, they say that unless i have a cert, i cant use file conn API and many other APIs that is defined as restricted!!!
    and for the cert, if i have a biz relation with moto, they could give a "Develop Certification", or i must pay a third party to get a cert...
    what a world~~~~~~~~~~~is unfair!!!

  • Do anybody know how to read file...

    Hello,
    I have a problem with reading config file. Do anybody know how to read config file from the same dir as class.
    Now the situation is like:
    filePath I hardcoded like:
    fileName = "C:\\apache-tomcat-5.5.17\\webapps\\ROOT\\WEB-INF\\classes\\config.sales";
    Is it possibility to read config file wich is used by java classes (in prj) from the same dir as classes are?
    Thanks in advance.

    If the file is in the class path you should be able to access it using the Class.getResourceAsStream method. It is the same concept as loading a properties file:
    http://www.javaworld.com/javaqa/2003-08/01-qa-0808-property_p.html

  • How to read file from server

    Hi,
    When i try to read file from server,the following message is displayed .
    ORA-29532: Java call terminated by uncaught Java exception: java.security.AccessControlException: the Permission (java.io.FilePermission /tmp read) has not been granted to EWMTRACKTEST. The PL/SQL to grant this is dbms_java.grant_permission( 'EWMTRACKTEST', 'SYS:java.io.FilePermission', ' /tmp', 'read' )
    ORA-06512: at "EWMTRACKTEST.GET_DIRLIST_EWM", line 1
    ORA-06512: at line 1
    thanks and regards
    P Prakash

    it seems obvious, user EWMTRACKTEST doesn`t have access to directory /tmp and the file under that.
    try to give read permission and try again.
    you could use command line like 'chmod' to grant permissions.

Maybe you are looking for

  • Since the Mountain Lion OS update today I've had issues with internet connection and e-mail, has anyone else?

    Since the Mountain Lion OS update today I've had issues with internet connection and e-mail, has anyone else?

  • Regarding  shortcut key in apex

    Hi I got this result after following the steps given in this link http://www.oracle-and-apex.com/keyboard-shortcuts-for-buttons/ and what to do next to get exact result and how to apply this on apex application. Plz suggest something. Register some g

  • Pull item code based on UDF

    Wondering if something like this is possible... We have a UDF in Item Master Data that contains our "web site item code" an alternate itemcode we use for sales on our web site. Is it possible to add a UDF (call it WebCode) to the row level of a Sales

  • How does Oracle Database compare with IBM DB2?

    Hi thank you for reading my post How Does ORACLE Database compare with IBM DB2 ? Which one has better performance with similar workload? Which one perform better on System Z hardware and z/OS? Is there any document that compare these two product? Tha

  • Submit a af:subform from outside the subform

    Hi friends, Can you tell how can i submitt the subform on button click from outside the subform . Event submitting the individual inputText or selectOneChoice will work , only thing is the button is outside the subform. This is to stop the validation