I am trying to read a file which have urdu data. When I view the file in Notepad++ it has data in urdu. But when I view it in eclipse then it shows some type of encoding (may be it has get some default).
Original Urdu Data (Notepad++):
"10","کراچی میں ٹماٹر کی قیمت میں کمی،25روپے فی کلو ہوگیا","Entertainment"
In eclipse:
"10","کراچی میں ٹماٹر کی قیمت میں کمی،25روپے �ی کلو �وگیا","Entertainment"
Now this is strange by default some encoding is happened. Is there any way that I can get data in original form so that when I do some processing on it and write it in file then I want processed data in original Urdu form instead of any encoding.
Here is the code.
public class DataProcessing {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
DataProcessing dataProcessingObj = new DataProcessing();
dataProcessingObj.readDataFromFile("small_dataset.txt");
}
private void readDataFromFile(String fileName)
{
BufferedReader br = null;
try{
br = new BufferedReader(new FileReader(fileName));
String line = "";
while( (line = br.readLine()) != null )
{
System.out.println(line);
}
}
catch(Exception ex){
ex.printStackTrace();
}
}
}
If you can help me I will be thankful to you.