I have a String in a file which is supposed to be read in using the nextLine() method in the Scanner class in the following way:
some_string = "All the staff in the operating room has been specifically trained with a theoretical and practical 20-hour course.\xe2\x80\xa9Results: The overall average incidence of adverse events reported was determined by 4.8%, is consistent with the expectations of the study protocol, and is at a lower level than the average median rate of international studies (8.9%).\n"
I create a scanner object in the following way:
Scanner br = new Scanner(new File("location of my file"), "UTF-8");
then i get the next lines by doing:
while (br.hasNextLine()) {
System.out.println(br.nextLine());
}
and I get:
>All the staff in the operating room has been specifically trained with a theoretical and practical 20-hour course.
>Results: The overall average incidence of adverse events reported was determined by 4.8%, is consistent with the expectations of the study protocol, and is at a lower level than the average median rate of international studies (8.9%).
It seems that nextLine() is failing when there are non ASCII characters. Any ideas why this happens?