LoginSignup
0
0

More than 3 years have passed since last update.

BOM付きのhtmlをBOM削除させる方法

Posted at

BOM削除する方法について調べた結果

色々調べたが、結局たどり着いたのが
nkf というbrewでインストールするもの(そこまでbrewは把握していないのでご了承ください)
※昔見ていたら、nkfってなんやねん!!ってきっとなっていたが、自然とbrewだろうな、、、と予測できた自分に感動しています

さて余談はおいておき本題へ
まずbrewでnkfをインストール

brew install nkf
nkf --version でインストールされているかチェック

BOMかどうかの判断

file index.html とか(基本tabでぽんぽん打てば調べられる)

調べるとこんな風に表示される(例)
index.html: HTML document text, UTF-8 Unicode (with BOM) text

nkf --overwrite --oc=UTF-8 index.html
とかやると消える

index.html: HTML document text, UTF-8 Unicode text

まとめ

他に多分オプションの設定とかあるんでしょうが、一旦これでできたっぽいのでメモとして保存

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