From reading the TeX source, it seems that the input_ln procedure is responsible for removing trailing spaces from lines upon input (before category codes are considered). A very short excerpt from the code there is
if buffer[last-1]<>" " then last_nonblank:=last;
end;
The test appears to target specifically spaces, and not tab characters. However, doing some tests, I see that TeX also removes tabs (regardless of catcodes). For instance, running
echo -e "\\\\catcode9=12\\\\show\\t%" | tex
correctly shows the character <tab>, but omitting the % there is no output.
So... Which part of TeX removes trailing tabs?
input_lnis in the change file, because it's system specific. – egreg Sep 14 '12 at 20:22