StringBuffer contents=new StringBuffer();
BufferedReader input = new BufferedReader(new FileReader("/home/xyz/abc.txt"));
String line = null; //not declared within while loop
while (( line = input.readLine()) != null){
contents.append(line);
}
System.out.println(contents.toString());
File abc.txtcontains
\u0905\u092d\u0940 \u0938\u092e\u092f \u0939\u0948 \u091c\u0928\u0924\u093e \u091c\u094b \u091a\u093e\u0939\u0924\u0940 \u0939\u0948 \u092
I want to talk in Hindi in the console using Java.
if I just print like this String str = "\ u0905 \ u092d \ u0940 \ u0938 \ u092e \ u092f \ u0939 \ u0948 \ u091c \ u0928 \ u0924 \ u093e \ u091c \ u094b \ u091a \ u093e \ u0939 \ u0924 \ u0924 \ u0924 \ u0924 \ u0948 \ u0940 \ "
System.out.println (ul);
then it works fine, but when I try to read from a file, it does not work.
help me.
source
share