I have normal String property inside an object, containing accented characters. If I debug the software (with Netbeans), into the variables panel I will see that string in the right way:
But when I'm going to print out the variable with System.out.println I will see strange things:
As you can see every "à" become "a'" and so on, and this will lead to a wrong character count, even in Matcher on the string.
How I can fix this? I need the accented characters, to have the right characters count and to use the matcher on it. I tried many ways but is not going to work, for sure I'm missing something.
Thanks in advance.
EDIT
EDIT AGAIN
This is the code:
public class TextLine {
public List<TextPosition> textPositions = null;
public String text = "";
}
public class myStripper extends PDFTextStripper {
public ArrayList<TextLine> lines = null;
boolean startOfLine = true;
public myStripper() throws IOException
{
}
private void newLine() {
startOfLine = true;
}
@Override
protected void startPage(PDPage page) throws IOException
{
newLine();
super.startPage(page);
}
@Override
protected void writeLineSeparator() throws IOException
{
newLine();
super.writeLineSeparator();
}
@Override
public String getText(PDDocument doc) throws IOException
{
lines = new ArrayList<TextLine>();
return super.getText(doc);
}
@Override
protected void writeWordSeparator() throws IOException
{
TextLine tmpline = null;
tmpline = lines.get(lines.size() - 1);
tmpline.text += getWordSeparator();
tmpline.textPositions.add(null);
super.writeWordSeparator();
}
@Override
protected void writeString(String text, List<TextPosition> textPositions) throws IOException
{
TextLine tmpline = null;
if (startOfLine) {
tmpline = new TextLine();
tmpline.text = text;
tmpline.textPositions = textPositions;
lines.add(tmpline);
} else {
tmpline = lines.get(lines.size() - 1);
tmpline.text += text;
tmpline.textPositions.addAll(textPositions);
}
if (startOfLine) {
startOfLine = false;
}
super.writeString(text, textPositions);
}
}