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.

ヒア文字列内の文字コードを変換する

Posted at

文字化けしちゃって解読不能…そんな時とりあえず文字化けしている中身を見たいとき
mb_convert_encodingが使えます。

例)SJISと仮定して、UTF8で表示する。

index.php
$output = <<< EOL

HTML

EOL;
// UTF-8をSJISに変換
echo mb_convert_encoding($output,"SJIS","UTF-8");

utf8で正解ならば、ブラウザで確認した際ちゃんと表示されます。

以上!
実際に文字化けを直したい方はこちらの記事をご参考下さい
htmlが文字化けした時確認すること3つ
Linux(CUI)上でShift-JISのphpファイルをutf8に変換

0
0
2

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?