manusimidt / py-xbrl

Python-based parser for parsing XBRL and iXBRL files
https://py-xbrl.readthedocs.io/en/latest/
GNU General Public License v3.0
116 stars 46 forks source link

parse_ixbrl should add encoding argument #81

Closed fhopecc closed 2 years ago

fhopecc commented 2 years ago

If the encoding of instance is utf8 but the locale encoding is cp950, then it crahsed. Just adding encoding option to specified the encoding of the instance file for parse_ixbrl function as following:

def parse_ixbrl(instance_path: str, cache: HttpCache, instance_url: str or None = None
               ,encoding='utf8'
               ) -> XbrlInstance:

    instance_file = open(instance_path, "r", encoding=encoding)
manusimidt commented 2 years ago

Sounds like a good suggestion. I will implement it in this week.

fhopecc commented 2 years ago

Thanks for adding this function!