Try this:

String file = new String(dataByte s,"ISO-8859-1");

int startPos = ((file.substrin g(0, pos)).getBytes("ISO-8859-1")).length;

int endPos = ((file.substrin g(0, boundaryLocatio n)).getBytes("ISO-8859-1")).length;