How can I replace text in PDF with iText without encoding issue? (Android)
<p>I need some help. I want to replace a text with an another in a PDF file (I'm using iText library), but when I'm trying to do it with accent letters, it has encoding problems.</p>

<pre><code>public static void manipulatePdf(String src, String dest) throws IOException, DocumentException {
    PdfReader reader = new PdfReader(src);
    PdfDictionary dict = reader.getPageN(1);
    PdfObject object = dict.getDirectObject(PdfName.CONTENTS);
    if (object instanceof PRStream) {
        PRStream stream = (PRStream) object;
        byte[] data = PdfReader.getStreamBytes(stream);


        String eredeti = "öüóá";
        final String s = new String(eredeti.getBytes(), BaseFont.CP1250);

        stream.setData(new String(data).replace("Hello World", s).getBytes());
    }
    PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));
    stamper.close();
    reader.close();
}
</code></pre>

<p>But when I open the PDF file, I see this:
<a href="http://i.stack.imgur.com/gNk7D.png" rel="nofollow">Wrong PDF</a></p>

<p>I've already tried all encoding types, to get the right letters (öüóá), but it never worked for me.</p>

<p>Has anybody any idea what should I do ? </p>