mega 2560 programming serial comm quesiton

HI,
I've recently began work with an arduino mega 2560 (the one with the solid state chip). I've been trying to establish serial communication through it using this simple program in the 1.01 and r23 IDEs

void setup ()
{
  Serial.begin(9600);
}
void loop()
{
  while(Serial.available()>0)
{
int val = Serial.read() -'0';

 
  Serial.println(val);
}
}

When I send values to the com port however, arduino sends back oct characters that do not correspond with the value I put in. I tried changing the baud rate to 115200, this only changed the oct characters put out. I then decreased the baud rate to 4800, and got an output that was closer to what I was looking for, however what is being sent to the com port is
"1
-38
2
-38"
for input values of "1" and "2"
Does anyone know what is causing this, or how to fix it?

-38 + '0' = 10 = \r

That is the new line character.

You can tell the Serial Monitor on the IDE to not send new line characters (drop down in the bottom right)

Thanks! when I switched to "no line ending" everything came out as expected