Not Break the binary file

by lighfu

Version 1 (July 18, 2020)

Download (177 downloads)

Optimal encoding/decoding of secure reading and writing of binary files.



I've been facing the problem that when I re-save the file I read, it obviously changes size.

I knew there was a problem with the encoding scheme, but when I was wondering which one would avoid breaking the binary file, the cause was simple.

I've been using US-ASCII as it is, but I noticed that all byte codes after 127 have the same value.

This means that it only supports values ​​from 0 to 127,
It seems that it did not follow the rule of 1byte = 8bit (256).

I tried various encodings and found that ISO-8859-1, which is supported by Automate's encoding, is the best choice.



私は以前から、読み取ったファイルを再度、書き込みし直すと明らかにサイズが変化している問題に直面してきました。

エンコード方式に問題があることは確認していましたが、どの方式を使用すれば、バイナリファイルを壊さずに済むのかを考えていたところ、原因は単純なものでした。

いままでは、 US-ASCII を使ってきましたが、127以降のバイトコードがすべて同じ値になっていることに気づきました。

これは、0-127 までの値にしか対応していないことを意味し、
1byte = 8bit (256) のルールに従っていなかったようです。

様々なエンコードを試し、Automate のエンコードサポート下である、ISO-8859-1 が最適であることがわかりました。

4.9 average rating from 7 reviews

5 stars
6
4 stars
1
3 stars
0
2 stars
0
1 star
0
Reports
0

Rate and review within the app in the Community section.