-2

Code from text editor

enter image description here

Terminal Error.

enter image description here

I'm trying to set up Moss(stanford plagarism checker for CS), and when I run the script an error not recognizing semicolon in the script comes up?.

This is being run on Mac OSX using textwrangler as the text editor.

Unrecognized character \xC2; marked by <-- HERE after t_l = "c";<-- HERE near column 14 at ./moss.pl line 173.

Naing Lin Aung
  • 3,373
  • 4
  • 31
  • 48
stephane
  • 29
  • 3
  • 2
    Show the relevant part of the file? – Shawn May 21 '19 at 02:45
  • 4
    I had something similar recently, turns out I had pasted the code from another text editor and got some invisible special character (page break) in there. I deleted the problem section and re-typed it and it was fine. – Bman70 May 21 '19 at 02:56
  • You need a [mcve] with the code in the body of your question. Screenshots don't help. – Shawn May 21 '19 at 03:39
  • 1
    Please don't post images of text. We can't copy and paste images of text. – Dave Cross May 21 '19 at 08:18
  • Stephane good attempt at using this site. Do seek to respond to the comments by Dave Cross and Shawn above. It will be appreciated and help you benefit from this site in future. I up voted your question as I think the issue you raise is worthy, and I acknowledge your new to posting questions. Encouragement I hope. – Cam_Aust May 28 '19 at 09:17
  • Please add code, errors and data as **text** ([using code formatting](//stackoverflow.com/editing-help#code)), not images. Images: A) don't allow us to copy-&-paste the code/errors/data for testing; B) don't permit searching based on the code/error/data contents; and [many more reasons](//meta.stackoverflow.com/a/285557). In general, code/errors/data in text format >>>> code/errors/data as an image >> nothing. Images should only be used, *in addition to text in code format*, if having the image adds something significant that is not conveyed by just the text code/error/data. – Makyen Jun 12 '19 at 20:18

1 Answers1

4

It's not complaining about the semi-colon (which is 3B), it's complaining about a byte with value C2 after it. That's not legal ASCII (which is expected if you don't use use utf8;) though it might be the start of a legal UTF-8 sequence (which is expected if you do use use utf8;)

You don't see it in the terminal or in the editor either because it's also junk to them, or because they expect UTF-8 and it's (the start of) some kind whitespace or unprintable UTF-8 character.

It's likely a U+00A0 NO-BREAK SPACE, which UTF-8 encodes to C2 A0. This would appear as a normal space in a terminals and editors that expects UTF-8.

Retype the line to replace the NBSP with a normal space, or add use utf8; to have Perl to treat the source code as UTF-8.

ikegami
  • 367,544
  • 15
  • 269
  • 518