4

I'm currently working on a project which locally works just fine but once I upload it to my hoster's server it just throws errors. My hoster says that it's the fault of BOMs inside the file. How do I get rid of them inside VS Code or Brackets?

ncls.
  • 113
  • 1
  • 7
  • Any BOM inside comes from included files - Byte Order Mark is at start always. Get rid with this included - save them without the BOM – black blue Oct 03 '20 at 17:45
  • So if I include a file BOMs appear? I include one file. I saved both files (the one that includes and the included) without BOM now and the error is gone. But the problem doesn't get solved in another file. – ncls. Oct 04 '20 at 17:41

1 Answers1

9

In VS Code, the encoding information can usually be found at the bottom right of the editor window, along with end-of-line sequence (LF, CRLF) and language mode (PHP, JavaScript, etc.).

If the text file includes a BOM (Byte Order Mark) at its very beginning, UTF-8 with BOM should be displayed down there in a clickable area. Mouse-clicking on it will bring an Action pop-up menu at the top of the window, coming with two items:

  • Reopen with Encoding
  • Save with Encoding

Select the Save with Encoding action, then UTF-8 in the next Encoding pop-up menu. This will get rid of the embedded BOM for the current file.

This is referenced in the VS Code online documentation: Basic Editing > File Encoding Support

Alalalala
  • 91
  • 2
  • Oh, already saw that but didn't know if offered more options when I click. Anyways, in my normal page (https://caddit.ncls.nl) the error is gone but it still doesn't do what it's supposed to do (redirect you to login). The login page (https://caddit.ncls.nl/login) still has problems with "headers already sent", which the BOM removing normally should fix according to my hoster. – ncls. Oct 04 '20 at 16:21