SyntaxError: Invalid character '\u0008' me

2019-08-30 00:55发布

I am setting up a server and am getting a strange error I have never seen before:

enter image description here

It is complaining about line 1 in the source, but that is just the DOCTYPE tag!

<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <!-- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -->
    ...

As you can see I already tried setting the Content-Type to be something other than utf-8. What is happening here?

2条回答
Luminary・发光体
2楼-- · 2019-08-30 01:01

The actual cause of the error is not located at line 1. For example, using eval also causes errors to be reported at line 1.

Look in your source code for the BACKSPACE U+0008 character. A method to spot this invisible character is described here.

查看更多
乱世女痞
3楼-- · 2019-08-30 01:06

What happens if you add an comment on line1?

<!--empty line for the fun of it-->
<!DOCTYPE HTML>
查看更多
登录 后发表回答