yes !!
devi usare un encoding...
ti posto una funzione di lettura da un input stream che ho io..
come puoi vedere uso come encoding "ISO-8859-1".. ti toglie i caratteri sporchi..
prova a guardare con google quella che fa al caso tuo, ce ne sono molte..
questa è solo la dritta, poi sta a te applicarla.. se hai bisogno nello specfico sono qui cmq..
codice:
public String read(InputStream is) throws Exception
{
InputStreamReader in = new InputStreamReader(is, "ISO-8859-1");
int n, i;
char c;
String answer = new String(EMPTY_STR);
for (i=0;i<10;i++) // look 10 times for character string to receive
{
//----- collect all characters from the serial line
while (in.ready()) // there is a byte available
{
n = in.read(); // get the byte from the serial line
if (n != -1) // one byte received
{
c = (char)n; // convert the received integer to a character
answer = answer + c; // collect the characters from the serial line
Thread.sleep(1); // wait 1 msec between every collected byte from the mobile phone [Timing]
} // if
else break; // no more bytes available
} // while
Thread.sleep(100); // wait 100 msec [Timing]
} // for
in.close();
strMsgs = "RICEVUTO: "+answer;
lh.debugOperazioni(LOGGER_PREFIX, strMsgs, this.getClass().getName(), "read()", Level.DEBUG_INT);
return answer; // give the received string back to the caller
} // read