'Reads file contents using given `charset` and returns it as text.'

def get_filecontent(self, filename, charset):

    if (charset == u'utf-8'):
        charset = u'utf-8-sig'
    with codecs.open(filename, u'r', charset) as fd:
        try:
            return fd.read()
        except IOError as e:
            raise UncompressableFileError((u"IOError    while    processing    '%s':    %s" % (filename, e)))
        except UnicodeDecodeError as e:
            raise UncompressableFileError((u"UnicodeDecodeError    while    processing    '%s'    with    charset    %s:    %s" % (filename, charset, e)))
