jpotts / alfresco-api-java-examples

Examples showing how to hit the Alfresco Public API using Java.
43 stars 32 forks source link

File content is getting enocode when file been saved into alfresco. #5

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
1. take the file1.txt attached
2. take the file2.txt attached
3. upload both to the alfresco
4. use webdav to see the files i.e., file1.txt, file2.txt

Expected output is file content can not be encoded while seeing it through 
webdav.
actual output : file1.txt is not proper file2.txt is proper

i have generated file2.txt using the below program.

File file = new File("C:\\file1.txt");
        FileInputStream fis = new FileInputStream(file);
        InputStreamReader isr = new InputStreamReader(fis,"UTF-8");
        BufferedReader in = new BufferedReader(isr);
        FileOutputStream fo = new FileOutputStream(new File("C:\\file2.txt"));
        OutputStreamWriter osr = new OutputStreamWriter(fo);
        BufferedWriter bw = new BufferedWriter(osr);
        StringBuilder sb = new StringBuilder();
        String line;
        while((line = in.readLine()) != null) {         
                bw.write(line);
                bw.write("\n");
        }
        bw.close();
        osr.close();
        fo.close();
        in.close();
        isr.close();
        fis.close();

Problem:- when i upload files through alfresco UI, file1 content is getting 
encode, but not file2 at the time of viewing the file using webdav. if i upload 
both the files through java program and if i see the file contents using webdav 
both the file contents are getting encode. the code used to upload the file to 
alfresco is attached in the file code.txt.

we need to upload the file asitis. with out changing the encoding style at the 
time of upload the file to Alfresco using java program mentioned in the 
code1.txt

please help me in this

thanks,
Saran.

Original issue reported on code.google.com by emailtos...@gmail.com on 12 Mar 2014 at 3:27

Attachments: