Search code examples
javascriptsafaritextedit

TextEdit: Simple JS code snippet throws exception


I just tried to write some little js code piece. I use macs TextEdit (until I choose a better editor). Code:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
</head>
<body><script type="text/javascript">
console.log(„Hello World!“);
</script>
</body>
</html>

If I try to open that snippet in Safari then I get the message:

[Error] SyntaxError: Invalid character '\u8222' (anonymous function) (index.html, line 6)

In my opinion should line 6 be ok, what is my mistake? Could it be because of TextEdit?

Thanks in advance.


Solution

  • Ok, i could solve the problem. There are two settings which you need to set in TextEdit:

    1. new document/format -> change to plain text
    2. new document/options -> deactivate "intelligent quotation marks"

    Then it works perfectly.