1
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?

どうしてZIPは文字化けするの?どうして7zは文字化けしないの?

Posted at

はじめに

ZIPファイルを解凍した際に文字化けすることがあります。
一方で、7zファイルでは文字化けしたことがありません。
この違いについて調査しました。

ZIPが文字化けする理由

ZIPファイルの内部データには、ZIPファイルに含まれるフォルダ名やファイル名がUTF-8でエンコードされているかどうかを示すフラグがあります。
このフラグが立っていない場合、文字コードが判定できず、文字化けしてしまう可能性があります。

7zファイルが文字化けしない理由

7zファイルの公式仕様では、7zファイルに含まれるファイル名がUnicodeであると定められています。
したがって、7zファイルでは文字化けが発生しにくいです。

おわりに

7zファイルは、ZIPファイルと違い、文字コードが明確に定められているため、文字化けしにくいことがわかりました。
ただし、アーカイバの実装によっては、7zファイルでも文字化けが発生するかもしれません。

参考文献

1
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
1
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?