0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【html】文字コード指定の小さなサンプルメモ

Posted at
  • htmlのheadのmetaタグに文字コードを指定する
  • 実際のファイルの文字コードと同一である必要がある

サンプル

文字化けする場合

UTF-8で指定するけど、実際のファイルはEUC-jpで保存したら、↓

index.html
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>index.html</title>
</head>
<body>
ほげほげ
</body>
</html>

ScreenClip.png

ブラウザで開くと文字化けする

結果
�ۤ��ۤ�

しない場合

ファイル内でもeuc-jp指定で保存すればおk

index.html
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="euc-jp"><title>index.html</title>
</head>
<body>
<a href="category1.html">category1.html</a>
<a href="category2.html">category2.html</a>
<a href="recent.html">recent.html</a>
ほげほげ
</body>
</html>

参考

FileCode Checkerの詳細情報 : Vector ソフトを探す! https://www.vector.co.jp/soft/winnt/util/se478635.html?ds

文字のエンコードを指定する:HTMLタグ辞典 - HTMLタグボード http://www.dspt.net/html_tag/001_data/017.html

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?