0

enter image description here

My laptop restarted and when it switched back on, I was unable to run any of the code that had been working previously. As you can see it says there is an error in line 1, saying there is an invalid character, but this had been working before so I am unsure what is wrong and know that it should start in this way. If anyone could help me it would be greatly appreciated.

  • 2
    the log is saying that the file is full of nulls (byte 0) but the editor window is clearly showing text. so I'd save that file probably under a different name before doing anything else – David Carlisle Jan 8 '17 at 21:06
  • Perhaps some invisible character has been added at the start of the line, if you move the cursor to the \ and hold backspace that might be a start. It would have been helpful if you'd copied and pasted the code (and the error message) into the question. Highlight the lot and press ctrl+k (or the code sample button, which is the one like {}) to apply the correct highlighting. This is really good practice in future too – Au101 Jan 8 '17 at 21:07
  • I copied and pasted the whole thing into a new file and that seemed to do it, thank you – Declan Wardell Jan 8 '17 at 21:26
3

That seems a lot like an encoding problem to me, a thing that works well in this cases is to erase the line and retype it (not copy/paste). If you get an error on line 2, this means that your encoding is corrupted.

The thing to do then is to edit your file in an editor that allows to display "invisible characters" which are those that causes the problem.

It's a windows related problem, working with utf8 instead of microsoft's one should prevent it from reappearing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.