# How do I remove an invisible backspace character in a .tex file?

I am running a .tex file using xelatex. It crashes with this error:

! Text line contains an invalid character.
l.22 ^^H
egin{document}
?


I understand the ^H is a backspace character. It's not revealed by Emacs's whitespace-mode. I believe the problem has something to do with the file's encoding. Most of the tex code was pasted into this Emacs file from a tex file that I was running in TexShop. I have deleted and retyped the offending line but that doesn't work.

Any help appreciated.

• just delete the whole of lines 21 and 22 and retype them (if it is at start of line it may not have gone when you deleted line 22) but it looks like the \b at the start of \begin has been re-interpreted as a backspace. If that's happened throughout the file it's going to be quite corrupted. – David Carlisle Oct 29 '15 at 18:03
• Yes, you were right: Python translated the \b as a backspace. It worked when I escaped the backslash like so: \\b. Thanks for the help. – Pete Kelly Oct 29 '15 at 23:37

Some process (confirmed in comments to be python) had mis-interpreted the backslashes in a TeX string so converting \b in \begin to a backspace character control-H.