Encoding: Create helper functions for some libarchive calls.

These helper functions reduce the number of conditionals.
Merge topic 'libarchive-encoding' into next

d5160fd4 Encoding: Create helper functions for some libarchive calls.