read the encoding of each resource and decode the file respectively