Alvaro
Alvaro

Reputation: 41595

Can't print € symbol in console.log?

I'm pretty sure this is a very silly question but... I'm trying to output the Euro simbol (€) using console.log but I keep getting the following output:

€

I'm using UTF-8 for the encoding of my HTML file and the following is my whole html:

<!DOCTYPE html>
<html>
<head>
</head>

<body>
  <script type="text/javascript">
    console.log('€');
  </script>
</body>

Funny thing is, when I rename the file from index.html to index.php, then the console.log outputs the Euro symbol correctly.

What's going on here?

Upvotes: 1

Views: 573

Answers (2)

mbojko
mbojko

Reputation: 14669

The charset declaration is missing:

<meta charset="UTF-8">

Upvotes: 3

JoRoFo
JoRoFo

Reputation: 71

try this:

console.log('\u20AC');

Upvotes: 1

Related Questions