How to read encoded string using java

时间:2016-07-11 19:06:00

标签: java

There is a CSV file which is placed in FTP. It contains Id,File Name and URL. First I am downloading the CSV file locally and reading the element by element. The file name contains special characters.

public void readCsvFileForImport(String csvFile, String country,
        String operation) throws Exception {

    LOGGER.info("Reading CSVFile "
            + new SimpleDateFormat("dd/MM/yyyy HH:mm:ss")
            .format(new Date()));
    BufferedReader fileReader = null;
    boolean result = false;
    SharePointVO sharePointVO = null;

    try {
        /** Create the file reader*/
        fileReader = new BufferedReader(new FileReader(csvFile));
        String line = null;
        fileReader.readLine(); // Skip the csv header

        while ((line = fileReader.readLine()) != null) { // Read the file
            // line by line
            // Get all tokens available in line

            /** Count line from CSV file */
            counterline++;
           LOGGER.info("start");
            String[] element = line.split(SPCToolConstants.DELIMITER);
            LOGGER.info("rowId "+element[0]);
            String rowId = element[0];
            String objectType = element[1];
            String countryFromCSV = element[2];
            LOGGER.info("Before file Name"+element[3]);
            String fileName = element[3];               
            String sharepointFolderName = element[4];

The csv file values are ARKA-3OWXXF|Temporäre.ppt|D:\Temporäre.ppt

The file name displaying as Temporäre.ppt due to this local drive file not able to read and file not found exception coming.

How to get file name as same as which is contain csv file? How to decode the file name field. Please help me

0 个答案:

没有答案