Click here to Skip to main content
15,921,660 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
import java.io.*;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.PrintWriter;
public class ww {
public static void main(String[] args)throws FileNotFoundException, UnsupportedEncodingException, IOException {
    BufferedReader input;
String title;
File intermediate = new File("myfile1.txt");
    PrintWriter output = new PrintWriter(intermediate, "UTF-8");
    String p = "hh";
    File dir = new File(p);
   File[] files = dir.listFiles();
    for (File f : files) {
      if (f.isFile()) {
 input = new BufferedReader(new FileReader(f));
title = String.format("[%s\n_DATE]", f.getName());
 output.println(title);
        System.out.println(title);
        while ((title = input.readLine()) != null) {
          output.println(title);
          System.out.println(title);
        }
        input.close();
      }
    }
    output.close();
    input = new BufferedReader(new FileReader(intermediate));
    int count = 0;
    output = null;
    while ((title = input.readLine()) != null) {
      if (title.startsWith("[")) {
        if (output != null) output.close();
int index =title.indexOf (".");
 title= title.substring (0, index);
title = title.replace("["," ");
        output = new PrintWriter(new File(title +".txt" ), "UTF-8");
output.print("[");
output.print(title);

        count++;
        continue;
      }
      output.println(title);
    }
    input.close();
  }
}
Posted
Comments
Sergey Alexandrovich Kryukov 22-Dec-15 0:24am    
Language makes no difference. If it works for English, should work for Tamil, or text mixing several languages.
—SA
Member 12200805 22-Dec-15 0:42am    
if i am using tamil files..getting output like this... [ இன�டர�வியூதெரிந�த�கொள�ள�ங�கள�_-Dinamani-TamilDailyNews_DATE]
 à ®¤à ¯‡à ®°à ¯�à ®µà ¯� à ®Žà ®©à ¯�à ®±à ®¾à ®²à ¯‡ à ®ªà ®³à ¯�à ®³à ®¿ à ®®à ®¾à ®Â
Darren_vms 22-Dec-15 5:23am    
try displaying the file with the font "Arial Unicode MS" this should work for both English text and Tamil.

1 solution

I think this will help you http://unicode.org/charts/PDF/U0B80.pdf[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900