Alberto Rossi
Alberto Rossi

Reputation: 1800

HTML meta charset not working

At the beginning of my page, I have the following code:

<HTML>
<head>
<meta charset="utf-8">
<title> 
//other

I used the meta because I have to put in my website some Japanese characters. Here you can see an example:

<tr>
<td><label class="blacktd" onmouseover="apriimg('imgbox', '4');"> Shy Guy Bazaar </label></td>
<td><a href="http://www.youtube.com/watch?v=kpmkZIcD7fc">2'03"007</a></td>
<td>そうめん</td> //look at here
<td><img src="http://mk7vrlist.altervista.org/flags/jp.gif" /></td>
<td>2013/06/30</td>
</tr>

I googled this and I saw that I simply need to put that tag with the charset attribute. By the way my webpage shows %u305D%u3046%u3081%u3093 instead of "そうめん". Do you know why?

Upvotes: 7

Views: 49475

Answers (3)

Esmu Igors
Esmu Igors

Reputation: 249

Thanks to all answerers, but I have had troubles solving it, as I saved the file in two editors (Leafpad and vim) as UTF-8, still getting weird characters in browser. The culprit was, as described here, the byte order mark, which seems not to be set by default in both the editors but has to be set explicitly in vim:

:set bomb

This solved the problem for me finally.

Upvotes: 1

Michael
Michael

Reputation: 108

Is your doctype HTML5

<!DOCTYPE html>

if not you have to use this for all other doctypes

<meta http-equiv="content-type" content="text/html; charset=utf-8">

Upvotes: 5

Quentin
Quentin

Reputation: 943579

Because either:

  • You have an HTTP header which specifies a different character encoding (HTTP headers take priority over meta elements) or
  • You haven't saved the document using UTF-8 (you are just telling the browser that you are)

Upvotes: 19

Related Questions