0

How do I get Chrome to display a text file containing backspace characters?

I have a static text file on a server that contains backspace characters (ASCII code 08), and when I navigate the file's URL in Chrome (or Safari), the browser downloads the file to a folder instead of viewing the file's text in the browser window.

I've confirmed that the Content-type header is sent correctly, and if I remove the backspace characters, it works correctly again and displays in the browser.

I don't care if the browser shows an odd glyph or code where the backspace is, or if it dutifully removes characters preceding the backspaces, but I do want to view the file in the browser.

I have control of the server, so I can send custom headers if that helps. Also a browser plugin/extension would be okay.

Arthur Hebert-Ryan
  • 1,802
  • 18
  • 24
  • Can you pass the file through a script on the server before serving it? The script can remove the backspaces and the characters before them. It's an easy [preg_replace](http://php.net/preg_replace) in PHP, using something like [this](http://stackoverflow.com/questions/3644266/how-can-we-match-an-bn-with-java-regex) for the RegEx. – pieman72 May 15 '14 at 07:48
  • Ah, good point. Unfortunately, scripting is not an option in this particular case. – Arthur Hebert-Ryan May 16 '14 at 01:51
  • 1
    The issue seems to be webkit-based, but I've not found any client-side solutions. For the record, this behavior seems to happen with all non-rendering characters, not just backspace. As far as I can see, you'll have to modify the file contents on the server-side before/during serving. Hope someone else knows something I don't. – pieman72 May 16 '14 at 03:34

0 Answers0