I have a tsv file and it contains Unicode data like "Pär Lagerkvist's received Nobel Prize in Physics." But while reading it in Java I am receiving output like "P r Lagerkvist's received Nobel Prize in Physics."
I am using the following piece of code for the file reading
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(fileName), "UTF-8"));
while ((st = br.readLine()) != null) {
System.out.println(st);
}
I assume you are using Intellij Idea. This case, set console encoding
-Dfile.encoding=UTF-8
On Windows, edit idea.exe.vmoptions
file and add the above line.
See this for details.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.