开发者

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开发者_如何学Python 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();}


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜