I am parsing CSV file, there I encounter special characters like á.
String line = scanner.nextLine();
Can any one help me to remove á and corrupted characters from the string line.
I tried the following
line.replaceAll("[^a-zA-Z0-9]+","");
but it replacing :, / [ ] symbols.
inputStream = filePart.getInputStream();
Scanner scanner = new Scanner(inputStream);
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
System.out.println("Line : " + line.trim());
String[] fields = line.split(",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)", -1);
for (int i = fields.length - 1; i >= 0; i--) {
System.out.println(i + " " + fields[i].replaceAll("[á]", ""));
}
awith acute accent is one of those, at 225. These two different ways to represent that character+diacritical may be your issue (just a guess).