a bunch of changes to support non-utf8 data in pieces element of metainfo files