On 7/26/07, Vadim Gritsenko <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > public void characters(char ch[], int start, int length) { > > - String val = new String(ch).trim(); > ... > > + String val = new String(ch); > > info.sb.append(val); > > Now, after I had a look at this piece, I realized that it was wrong then and > it > is still wrong now :)
Damn :) > String must be constructed only from the relevant part of the character > buffer: > > String val = new String(ch, start, length); > > Otherwise it can contain junk / extra data. It is a pure coincidence that it > worked at all. :) > > Even better would be to forgo string construction completely and use append > method: > > info.sb.append(ch, start, length); > > This would save one extra characters copying. Thanks for spotting the problem. Natalia