bobber205
bobber205

Reputation: 13372

File Encoding - Mysterious "?" Mark and "ILLEGAL Token" Error Messages

Come across this once in awhile.

Unpacked a zip file sent to me by a coworker. Loaded it up on my tomcat server to find out that there's this weird question mark at the beginning of the included JS file, preventing the JS file from being included properly.

I resaved the HTML file and the JS as new files and made sure encoding was UTF-8 and the line breaks were UNIX style.

Now I see the "ILLEGAL Token" error in Chrome and FF. Any ideas why?

EDIT: Adding JS that is causing the issue. Anything inherently wrong with this? Per a comment, I think the removal of BOM fixed the issue but still getting the "ILLEGAL Token" message.

if(typeof deconcept=="undefined"){var deconcept=new Object();}

Upvotes: 1

Views: 691

Answers (1)

Alohci
Alohci

Reputation: 82986

Hard to say with much confidence, but weird characters at the start of text files are very often the Byte Order Mark (BOM). See http://en.wikipedia.org/wiki/Byte_Order_Mark. Some software handles them well, and you see nothing, other software doesn't handle them correctly and you see weird characters.

Upvotes: 3

Related Questions