I read text file using following code
Stream<String> lines = Files.lines(Paths.get(path));
Set<String> set = lines.filter(s -> !s.startsWith("#") &&
!s.isEmpty()).collect(Collectors.toSet());
in file México word thats why it throws excption. How to handle this excpetion
I handle this exception as bellow ,you can choose your suitable charset
enter image description here
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.